Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt::Drawer blocks QMainWindow keyboard shortcuts
Forum Updated to NodeBB v4.3 + New Features

Qt::Drawer blocks QMainWindow keyboard shortcuts

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jazzycamel
    wrote on 5 Nov 2014, 11:55 last edited by
    #1

    Hi All,

    I have an app that constructs a QMainWidow with a QDockWidget configured to be MacOSX drawer widget using the Qt::Drawer window flag. In the QMainWindow I have a QToolBar containing a number of QAction's all of which have keyboard shortcuts associated with them. These shortcuts all work fine until I attach the QDockWidget at which point the actions no longer respond. They can be clicked on, they just don't respond to the keyboard shortcuts. If the QDockWidget is not attached, they work fine. If the QDockWidget is not configured to be a drawer, they work fine. I'm just wondering if anybody else has had this issue and can tell me if I'm doing something wrong or if this is a bug. Either way a solution/work around would be much appreciated.

    The following is a small example illustrating the problem:

    Drawers.pro
    @
    QT += core gui

    TARGET = Drawers
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h
    @

    mainwindow.h
    @
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow(){};
    };

    #endif // MAINWINDOW_H
    @

    mainwindow.cpp
    @
    #include "mainwindow.h"
    #include <QToolBar>
    #include <QAction>
    #include <QDockWidget>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
    {
    QToolBar *toolBar=addToolBar("ToolBar");
    QAction *action=new QAction("Action", this);
    action->setCheckable(true);
    action->setShortcut(Qt::Key_E);
    toolBar->addAction(action);

    // Commenting out the following two lines or removing
    // the Qt::Drawer window flag removes the problem
    QDockWidget *dw=new QDockWidget("", this, Qt::Drawer);
    addDockWidget(Qt::LeftDockWidgetArea, dw);
    

    }
    @

    main.cpp
    @
    #include <QtGui/QApplication>
    #include "mainwindow.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @

    All help and/or suggestions greatly appreciated :o)

    For the avoidance of doubt:

    1. All my code samples (C++ or Python) are tested before posting
    2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Nov 2014, 14:11 last edited by
      #2

      Hi,

      Which Qt/OS X combo are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jazzycamel
        wrote on 17 Nov 2014, 09:26 last edited by
        #3

        MacOSX 10.8.5 with Qt4.8.

        For the avoidance of doubt:

        1. All my code samples (C++ or Python) are tested before posting
        2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 18 Nov 2014, 00:31 last edited by
          #4

          Looks like you are hitting this "bug":https://bugreports.qt-project.org/browse/QTBUG-26282

          I'd recommend re-opening it with your findings

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved