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. Using QxtGlobalShortcut and getting error
Forum Updated to NodeBB v4.3 + New Features

Using QxtGlobalShortcut and getting error

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 3.9k 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.
  • V Offline
    V Offline
    vbmark
    wrote on last edited by
    #1

    I started a new GUI Application in Qt Creator and, to get QxtGlobalShortcut working, I followed the directions located here:
    "http://libqxt.bitbucket.org/doc/0.6/qxtglobalshortcut.html":http://libqxt.bitbucket.org/doc/0.6/qxtglobalshortcut.html

    In mainwindows.cpp I added:
    @#include <QxtGlobalShortcut>@

    Below this:
    @ui->setupUi(this);@

    I pasted their example:

    @ QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(window);
    connect(shortcut, SIGNAL(activated()), window, SLOT(toggleVisibility()));
    shortcut->setShortcut(QKeySequence("Ctrl+Shift+F12"));@

    In the projects .pro file below this:

    @QT += core gui@

    I added this:

    @CONFIG += qxt
    QXT += core gui@

    At the bottom of the .pro file I added this:
    @INCLUDEPATH += C:\Qt\libqxt\src\gui
    INCLUDEPATH += C:\Qt\libqxt\src\core
    INCLUDEPATH += C:\Qt\libqxt\include\QxtGui@

    The errors I am getting are:

    @error: no matching function for call to 'QxtGlobalShortcut::QxtGlobalShortcut(<unresolved overloaded function type>)'
    QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(window);
    error: no matching function for call to 'MainWindow::connect(QxtGlobalShortcut*&, const char*, <unresolved overloaded function type>, const char*)'
    connect(shortcut, SIGNAL(activated()), window, SLOT(toggleVisibility()));@


    Also, in their example, I changed the pointer "window" to "this" and I get this crazy error:

    @error: undefined reference to `_imp___ZN17QxtGlobalShortcutC1EP7QObject'@


    So I am stuck now. What am I doing wrong or what am I missing?

    Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Since you had to add the include path I wonder if Qxt is installed properly these lines

      @CONFIG += qxt
      QXT += core gui@

      should have been enough. If it's not the case, you might either add the path to the libQxt prf files to your environment variable or add the missing path and libraries to your LIBS variable

      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
      • V Offline
        V Offline
        vbmark
        wrote on last edited by
        #3

        I think Qxt is not installed properly.

        The first step from here: "http://dev.libqxt.org/libqxt/wiki/user_guide":http://dev.libqxt.org/libqxt/wiki/user_guide is ensure qmake is in the path and then run configure.bat.

        When I run that I get these kinds of errors:

        bq. Testing for Berkeley DB...
        BDB...
        mingw32-make -f Makefile.Release clean
        mingw32-make[1]: Entering directory 'C:/Qt/libqxt/config.tests/db'
        del release\main.o
        Could Not Find C:\Qt\libqxt\config.tests\db\release\main.o
        mingw32-make[1]: Leaving directory 'C:/Qt/libqxt/config.tests/db'
        mingw32-make -f Makefile.Debug clean
        mingw32-make[1]: Entering directory 'C:/Qt/libqxt/config.tests/db'
        del debug\main.o
        Could Not Find C:\Qt\libqxt\config.tests\db\debug\main.o
        mingw32-make[1]: Leaving directory 'C:/Qt/libqxt/config.tests/db'
        mingw32-make -f Makefile.Release
        mingw32-make[1]: Entering directory 'C:/Qt/libqxt/config.tests/db'
        compiling main.cpp
        main.cpp:1:16: fatal error: db.h: No such file or directory
        #include <db.h>
        ^
        .file "main.cpp"
        compilation terminated.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If you don't use any database stuff from Qxt you can just disable it

          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
          • W Offline
            W Offline
            weblife
            wrote on last edited by
            #5

            I was having troubles with this Qxt also. I have instead started to create my own class, I am just stuck on how I should connect functions to the hotkey, might finish it tomorrow. Here is what I have so far "SystemHotkey":https://github.com/CCi-BClark/SystemHotkey.

            Brandon Clark
            www.themindspot.com

            1 Reply Last reply
            0
            • W Offline
              W Offline
              weblife
              wrote on last edited by
              #6

              I don't know if you still are looking for a global hotkey solution but here is a class I put together for myself; "QSystemHotkey":https://github.com/CCi-BClark/SystemHotkey. There is an example application in the repository also.

              Please feel free to make it better!

              Brandon Clark
              www.themindspot.com

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vbmark
                wrote on last edited by
                #7

                Thanks Brandon but I've given up on qt and just went back to AutoHotkey. Thanks though.

                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