Commit 03e7bfab authored by Christoffer Ackelman's avatar Christoffer Ackelman

Fixed QT reordering dialog buttons.

parent d1b52cf9
...@@ -466,7 +466,7 @@ int WNavQt::confirm_dialog( ...@@ -466,7 +466,7 @@ int WNavQt::confirm_dialog(
char* title, char* text, int display_cancel, int* cancel) char* title, char* text, int display_cancel, int* cancel)
{ {
QMessageBox::StandardButton reply = QMessageBox::question( QMessageBox::StandardButton reply = QMessageBox::question(
form_widget, translate_utf8(title), translate_utf8(text)); form_widget, translate_utf8(title), translate_utf8(text), QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
return 1; return 1;
......
...@@ -810,8 +810,7 @@ void WttQt::open_change_value() ...@@ -810,8 +810,7 @@ void WttQt::open_change_value()
return; return;
} }
sts = wnav->check_attr_value( sts = wnav->check_attr_value(sellist[0], &multiline, &value, &input_size);
sellist[0], &multiline, &value, &input_size);
if (EVEN(sts)) { if (EVEN(sts)) {
message('E', wnav_get_message(sts)); message('E', wnav_get_message(sts));
return; return;
...@@ -948,8 +947,8 @@ void WttQt::open_change_name() ...@@ -948,8 +947,8 @@ void WttQt::open_change_name()
cmd_entry->set_recall_buffer(&name_recall); cmd_entry->set_recall_buffer(&name_recall);
cmd_entry->setFocus(); cmd_entry->setFocus();
sts = ldh_ObjidToName(ldhses, input_objid, ldh_eName_Object, name, sts = ldh_ObjidToName(
sizeof(name), &size); ldhses, input_objid, ldh_eName_Object, name, sizeof(name), &size);
cmd_entry->setText(QString::fromLatin1(name)); cmd_entry->setText(QString::fromLatin1(name));
...@@ -1374,16 +1373,16 @@ void WttQtWidget::valchanged_cmd_entry() ...@@ -1374,16 +1373,16 @@ void WttQtWidget::valchanged_cmd_entry()
switch (wtt->input_mode) { switch (wtt->input_mode) {
case wtt_eInputMode_Attribute: case wtt_eInputMode_Attribute:
wtt->input_wnav->select_object(wtt->input_node); wtt->input_wnav->select_object(wtt->input_node);
sts = wtt->input_wnav->set_attr_value( sts = wtt->input_wnav->set_attr_value(wtt->input_node, wtt->input_objid,
wtt->input_node, wtt->input_objid, qPrintableLatin1(wtt->cmd_entry->text())); qPrintableLatin1(wtt->cmd_entry->text()));
if (EVEN(sts)) { if (EVEN(sts)) {
wtt->message('E', wnav_get_message(sts)); wtt->message('E', wnav_get_message(sts));
} }
break; break;
case wtt_eInputMode_ObjectName: case wtt_eInputMode_ObjectName:
wtt->input_wnav->select_object(wtt->input_node); wtt->input_wnav->select_object(wtt->input_node);
sts = wtt->input_wnav->set_object_name( sts = wtt->input_wnav->set_object_name(wtt->input_node, wtt->input_objid,
wtt->input_node, wtt->input_objid, qPrintableLatin1(wtt->cmd_entry->text())); qPrintableLatin1(wtt->cmd_entry->text()));
if (EVEN(sts)) { if (EVEN(sts)) {
wtt->message('E', wnav_get_message(sts)); wtt->message('E', wnav_get_message(sts));
} }
...@@ -1451,8 +1450,9 @@ void WttQt::open_confirm(const char* text, const char* title, ...@@ -1451,8 +1450,9 @@ void WttQt::open_confirm(const char* text, const char* title,
confirm_no_cb = no_cb; confirm_no_cb = no_cb;
QMessageBox::StandardButton reply = QMessageBox::question(toplevel, QMessageBox::StandardButton reply = QMessageBox::question(toplevel,
translate_utf8(title), translate_utf8(text), translate_utf8(title), translate_utf8(text),
QMessageBox::Ok | QMessageBox::No | QMessageBox::Cancel); QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
if (reply == QMessageBox::Ok) {
if (reply == QMessageBox::Yes) {
if (ok_cb) { if (ok_cb) {
(ok_cb)(this); (ok_cb)(this);
} }
......
...@@ -36,15 +36,28 @@ ...@@ -36,15 +36,28 @@
#include "cow_style_qt.h" #include "cow_style_qt.h"
int PwrStyle::pixelMetric(PixelMetric which, const QStyleOption *option, const QWidget *widget) const #include <QDialogButtonBox>
int PwrStyle::pixelMetric(
PixelMetric which, const QStyleOption* option, const QWidget* widget) const
{ {
switch(which) { switch (which) {
case PM_LayoutLeftMargin: case PM_LayoutLeftMargin:
case PM_LayoutTopMargin: case PM_LayoutTopMargin:
case PM_LayoutRightMargin: case PM_LayoutRightMargin:
case PM_LayoutBottomMargin: case PM_LayoutBottomMargin:
return 0; return 0;
default: default:
return QGtkStyle::pixelMetric(which, option, widget); return QGtkStyle::pixelMetric(which, option, widget);
} }
}
int PwrStyle::styleHint(StyleHint hint, const QStyleOption* option,
const QWidget* widget, QStyleHintReturn* returnData) const
{
if (hint == SH_DialogButtonLayout) {
return QDialogButtonBox::WinLayout;
}
return QGtkStyle::styleHint(hint, option, widget, returnData);
} }
...@@ -39,15 +39,18 @@ ...@@ -39,15 +39,18 @@
#include <QGtkStyle> #include <QGtkStyle>
class PwrStyle : public QGtkStyle class PwrStyle : public QGtkStyle {
{ Q_OBJECT
Q_OBJECT
public: public:
PwrStyle() : QGtkStyle() {} PwrStyle() : QGtkStyle()
{
}
int pixelMetric(PixelMetric which, const QStyleOption *option, int pixelMetric(PixelMetric which, const QStyleOption* option,
const QWidget *widget = 0) const; const QWidget* widget = 0) const;
int styleHint(StyleHint hint, const QStyleOption* option,
const QWidget* widget, QStyleHintReturn* returnData = 0) const;
}; };
#endif #endif
\ No newline at end of file
...@@ -99,8 +99,9 @@ void CoWowQt::DisplayQuestion(void* ctx, const char* title, const char* text, ...@@ -99,8 +99,9 @@ void CoWowQt::DisplayQuestion(void* ctx, const char* title, const char* text,
void (*questionbox_ok)(void*, void*), void (*questionbox_ok)(void*, void*),
void (*questionbox_cancel)(void*, void*), void* data) void (*questionbox_cancel)(void*, void*), void* data)
{ {
QMessageBox::StandardButton reply = QMessageBox::question( QMessageBox::StandardButton reply
object->parent_wid, translate_utf8(title), translate_utf8(text)); = QMessageBox::question(object->parent_wid, translate_utf8(title),
translate_utf8(text), QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
if (questionbox_ok) { if (questionbox_ok) {
...@@ -393,9 +394,9 @@ CoWowWarrantQt::CoWowWarrantQt(CoWowQtObject* parent) ...@@ -393,9 +394,9 @@ CoWowWarrantQt::CoWowWarrantQt(CoWowQtObject* parent)
QPushButton* reject = buttons->addButton( QPushButton* reject = buttons->addButton(
translate_utf8("Quit"), QDialogButtonBox::RejectRole); translate_utf8("Quit"), QDialogButtonBox::RejectRole);
QPushButton* accept = buttons->addButton( QPushButton* accept = buttons->addButton(
translate_utf8("I Accept"), QDialogButtonBox::HelpRole); translate_utf8("I Accept"), QDialogButtonBox::ResetRole);
QPushButton* help = buttons->addButton( QPushButton* help = buttons->addButton(
translate_utf8("Show License"), QDialogButtonBox::AcceptRole); translate_utf8("Show License"), QDialogButtonBox::HelpRole);
connect(accept, SIGNAL(clicked()), this, SLOT(accept())); connect(accept, SIGNAL(clicked()), this, SLOT(accept()));
connect(reject, SIGNAL(clicked()), this, SLOT(reject())); connect(reject, SIGNAL(clicked()), this, SLOT(reject()));
...@@ -661,7 +662,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event) ...@@ -661,7 +662,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
break; break;
} }
case Qt::Key_Up: { case Qt::Key_Up: {
const char *prev = m_re->popUp(qPrintable(text())); const char* prev = m_re->popUp(qPrintable(text()));
if (strcmp(prev, "") != 0) { if (strcmp(prev, "") != 0) {
setText(fl(prev)); setText(fl(prev));
} }
...@@ -669,7 +670,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event) ...@@ -669,7 +670,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
break; break;
} }
case Qt::Key_Down: { case Qt::Key_Down: {
const char *next = m_re->popDown(qPrintable(text())); const char* next = m_re->popDown(qPrintable(text()));
if (strcmp(next, "") != 0) { if (strcmp(next, "") != 0) {
setText(fl(next)); setText(fl(next));
} }
...@@ -719,8 +720,8 @@ CoWowModalDialogQt::CoWowModalDialogQt(QWidget* parent, const char* title, ...@@ -719,8 +720,8 @@ CoWowModalDialogQt::CoWowModalDialogQt(QWidget* parent, const char* title,
image_w = new QPixmap(fname); image_w = new QPixmap(fname);
} else { } else {
image_w = new QPixmap(QApplication::style() image_w = new QPixmap(QApplication::style()
->standardIcon(QStyle::SP_MessageBoxQuestion) ->standardIcon(QStyle::SP_MessageBoxQuestion)
.pixmap(48)); .pixmap(48));
} }
QLabel* image_widget = new QLabel(this); QLabel* image_widget = new QLabel(this);
image_widget->setPixmap(*image_w); image_widget->setPixmap(*image_w);
...@@ -836,7 +837,8 @@ wow_sModalInputDialog* CoWowQt::CreateModalInputDialog(const char* title, ...@@ -836,7 +837,8 @@ wow_sModalInputDialog* CoWowQt::CreateModalInputDialog(const char* title,
wow_sModalInputDialog* ret = new wow_sModalInputDialog(); wow_sModalInputDialog* ret = new wow_sModalInputDialog();
ret->status = status; ret->status = status;
strncpy(ret->input_str, qPrintableLatin1(dialog_w->text()), sizeof(ret->input_str)); strncpy(ret->input_str, qPrintableLatin1(dialog_w->text()),
sizeof(ret->input_str));
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment