GTK+ dialogs: Get rid of deprecated GtkStock usage
GtkStock has been deprecated since GTK+ 3.10, and is removed in GTK+ 4. Use the standard button names provided by Qt instead. Change-Id: I55e8452178544b4a9ebf5c75b70f4c5c56c047f4 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
This commit is contained in:
parent
8e20daae9f
commit
1a1a0e3159
@ -38,6 +38,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qgtk3dialoghelpers.h"
|
||||
#include "qgtk3theme.h"
|
||||
|
||||
#include <qeventloop.h>
|
||||
#include <qwindow.h>
|
||||
@ -56,6 +57,11 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const char *standardButtonText(int button)
|
||||
{
|
||||
return QGtk3Theme::defaultStandardButtonText(button).toUtf8();
|
||||
}
|
||||
|
||||
class QGtk3Dialog : public QWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -237,8 +243,10 @@ QGtk3FileDialogHelper::QGtk3FileDialogHelper()
|
||||
{
|
||||
d.reset(new QGtk3Dialog(gtk_file_chooser_dialog_new("", 0,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL)));
|
||||
standardButtonText(QPlatformDialogHelper::Cancel), GTK_RESPONSE_CANCEL,
|
||||
standardButtonText(QPlatformDialogHelper::Ok), GTK_RESPONSE_OK,
|
||||
NULL)));
|
||||
|
||||
connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted()));
|
||||
connect(d.data(), SIGNAL(reject()), this, SIGNAL(reject()));
|
||||
|
||||
@ -435,9 +443,9 @@ void QGtk3FileDialogHelper::applyOptions()
|
||||
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
|
||||
gtk_button_set_label(GTK_BUTTON(acceptButton), opts->labelText(QFileDialogOptions::Accept).toUtf8());
|
||||
else if (opts->acceptMode() == QFileDialogOptions::AcceptOpen)
|
||||
gtk_button_set_label(GTK_BUTTON(acceptButton), GTK_STOCK_OPEN);
|
||||
gtk_button_set_label(GTK_BUTTON(acceptButton), standardButtonText(QPlatformDialogHelper::Open));
|
||||
else
|
||||
gtk_button_set_label(GTK_BUTTON(acceptButton), GTK_STOCK_SAVE);
|
||||
gtk_button_set_label(GTK_BUTTON(acceptButton), standardButtonText(QPlatformDialogHelper::Save));
|
||||
}
|
||||
|
||||
GtkWidget *rejectButton = gtk_dialog_get_widget_for_response(gtkDialog, GTK_RESPONSE_CANCEL);
|
||||
@ -445,7 +453,7 @@ void QGtk3FileDialogHelper::applyOptions()
|
||||
if (opts->isLabelExplicitlySet(QFileDialogOptions::Reject))
|
||||
gtk_button_set_label(GTK_BUTTON(rejectButton), opts->labelText(QFileDialogOptions::Reject).toUtf8());
|
||||
else
|
||||
gtk_button_set_label(GTK_BUTTON(rejectButton), GTK_STOCK_CANCEL);
|
||||
gtk_button_set_label(GTK_BUTTON(rejectButton), standardButtonText(QPlatformDialogHelper::Cancel));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user