Fix build without features.shortcut
Change-Id: I87a7ba1a77b0671559616a3ea4722bcc233af32d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
c1e19a2ecb
commit
a9e0879ee1
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
static guint qt_gdkKey(const QKeySequence &shortcut)
|
static guint qt_gdkKey(const QKeySequence &shortcut)
|
||||||
{
|
{
|
||||||
if (shortcut.isEmpty())
|
if (shortcut.isEmpty())
|
||||||
@ -75,6 +76,7 @@ static GdkModifierType qt_gdkModifiers(const QKeySequence &shortcut)
|
|||||||
|
|
||||||
return static_cast<GdkModifierType>(mods);
|
return static_cast<GdkModifierType>(mods);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QGtk3MenuItem::QGtk3MenuItem()
|
QGtk3MenuItem::QGtk3MenuItem()
|
||||||
: m_visible(true),
|
: m_visible(true),
|
||||||
@ -126,10 +128,12 @@ GtkWidget *QGtk3MenuItem::create()
|
|||||||
if (m_menu)
|
if (m_menu)
|
||||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(m_item), m_menu->handle());
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(m_item), m_menu->handle());
|
||||||
g_signal_connect(m_item, "select", G_CALLBACK(onSelect), this);
|
g_signal_connect(m_item, "select", G_CALLBACK(onSelect), this);
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
if (!m_shortcut.isEmpty()) {
|
if (!m_shortcut.isEmpty()) {
|
||||||
GtkWidget *label = gtk_bin_get_child(GTK_BIN(m_item));
|
GtkWidget *label = gtk_bin_get_child(GTK_BIN(m_item));
|
||||||
gtk_accel_label_set_accel(GTK_ACCEL_LABEL(label), qt_gdkKey(m_shortcut), qt_gdkModifiers(m_shortcut));
|
gtk_accel_label_set_accel(GTK_ACCEL_LABEL(label), qt_gdkKey(m_shortcut), qt_gdkModifiers(m_shortcut));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
gtk_widget_set_sensitive(m_item, m_enabled);
|
gtk_widget_set_sensitive(m_item, m_enabled);
|
||||||
gtk_widget_set_visible(m_item, m_visible);
|
gtk_widget_set_visible(m_item, m_visible);
|
||||||
@ -267,6 +271,7 @@ void QGtk3MenuItem::setChecked(bool checked)
|
|||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(m_item), checked);
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(m_item), checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
QKeySequence QGtk3MenuItem::shortcut() const
|
QKeySequence QGtk3MenuItem::shortcut() const
|
||||||
{
|
{
|
||||||
return m_shortcut;
|
return m_shortcut;
|
||||||
@ -283,6 +288,7 @@ void QGtk3MenuItem::setShortcut(const QKeySequence& shortcut)
|
|||||||
gtk_accel_label_set_accel(GTK_ACCEL_LABEL(label), qt_gdkKey(m_shortcut), qt_gdkModifiers(m_shortcut));
|
gtk_accel_label_set_accel(GTK_ACCEL_LABEL(label), qt_gdkKey(m_shortcut), qt_gdkModifiers(m_shortcut));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool QGtk3MenuItem::isEnabled() const
|
bool QGtk3MenuItem::isEnabled() const
|
||||||
{
|
{
|
||||||
|
@ -82,8 +82,10 @@ public:
|
|||||||
bool isChecked() const;
|
bool isChecked() const;
|
||||||
void setChecked(bool checked) override;
|
void setChecked(bool checked) override;
|
||||||
|
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
QKeySequence shortcut() const;
|
QKeySequence shortcut() const;
|
||||||
void setShortcut(const QKeySequence &shortcut) override;
|
void setShortcut(const QKeySequence &shortcut) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
void setEnabled(bool enabled) override;
|
void setEnabled(bool enabled) override;
|
||||||
@ -114,7 +116,9 @@ private:
|
|||||||
QGtk3Menu *m_menu;
|
QGtk3Menu *m_menu;
|
||||||
GtkWidget *m_item;
|
GtkWidget *m_item;
|
||||||
QString m_text;
|
QString m_text;
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
QKeySequence m_shortcut;
|
QKeySequence m_shortcut;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class QGtk3Menu : public QPlatformMenu
|
class QGtk3Menu : public QPlatformMenu
|
||||||
|
@ -148,6 +148,8 @@ QString qt_accHotKey(const QString &text)
|
|||||||
int ampIndex = qt_accAmpIndex(text);
|
int ampIndex = qt_accAmpIndex(text);
|
||||||
if (ampIndex != -1)
|
if (ampIndex != -1)
|
||||||
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1);
|
return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1);
|
||||||
|
#else
|
||||||
|
Q_UNUSED(text)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -3812,8 +3812,8 @@ void QFileDialogPrivate::_q_nativeEnterDirectory(const QUrl &directory)
|
|||||||
*/
|
*/
|
||||||
bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
|
bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
|
||||||
|
|
||||||
Q_Q(QFileDialog);
|
|
||||||
#if QT_CONFIG(shortcut)
|
#if QT_CONFIG(shortcut)
|
||||||
|
Q_Q(QFileDialog);
|
||||||
if (event->matches(QKeySequence::Cancel)) {
|
if (event->matches(QKeySequence::Cancel)) {
|
||||||
q->reject();
|
q->reject();
|
||||||
return true;
|
return true;
|
||||||
@ -4018,7 +4018,9 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
|
|||||||
}
|
}
|
||||||
#endif // QT_KEYPAD_NAVIGATION
|
#endif // QT_KEYPAD_NAVIGATION
|
||||||
|
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
int key = e->key();
|
int key = e->key();
|
||||||
|
#endif
|
||||||
QLineEdit::keyPressEvent(e);
|
QLineEdit::keyPressEvent(e);
|
||||||
#if QT_CONFIG(shortcut)
|
#if QT_CONFIG(shortcut)
|
||||||
if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back)
|
if (!e->matches(QKeySequence::Cancel) && key != Qt::Key_Back)
|
||||||
|
@ -1404,8 +1404,8 @@ void QMessageBox::changeEvent(QEvent *ev)
|
|||||||
*/
|
*/
|
||||||
void QMessageBox::keyPressEvent(QKeyEvent *e)
|
void QMessageBox::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
Q_D(QMessageBox);
|
|
||||||
#if QT_CONFIG(shortcut)
|
#if QT_CONFIG(shortcut)
|
||||||
|
Q_D(QMessageBox);
|
||||||
if (e->matches(QKeySequence::Cancel)) {
|
if (e->matches(QKeySequence::Cancel)) {
|
||||||
if (d->detectedEscapeButton) {
|
if (d->detectedEscapeButton) {
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
@ -1704,7 +1704,9 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool unknown = false;
|
bool unknown = false;
|
||||||
|
#if QT_CONFIG(shortcut)
|
||||||
bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;
|
bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (false) {
|
if (false) {
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user