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