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. Can't use SingleApplication
Qt 6.11 is out! See what's new in the release blog

Can't use SingleApplication

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 541 Views
  • 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.
  • A Offline
    A Offline
    AndrzejB
    wrote on last edited by
    #1

    I try https://github.com/itay-grudev/SingleApplication
    I set macro set(QAPPLICATION_CLASS QGuiApplication)
    but still error "QWidget: Cannot create a QWidget without QApplication"
    is in qwidget.cpp

    void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
    {
        Q_Q(QWidget);
        Q_ASSERT_X(q != parentWidget, Q_FUNC_INFO, "Cannot parent a QWidget to itself");
    
        if (Q_UNLIKELY(!qobject_cast<QApplication *>(QCoreApplication::instance())))
            qFatal("QWidget: Cannot create a QWidget without QApplication");
    
    JonBJ 1 Reply Last reply
    0
    • A AndrzejB

      I try https://github.com/itay-grudev/SingleApplication
      I set macro set(QAPPLICATION_CLASS QGuiApplication)
      but still error "QWidget: Cannot create a QWidget without QApplication"
      is in qwidget.cpp

      void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
      {
          Q_Q(QWidget);
          Q_ASSERT_X(q != parentWidget, Q_FUNC_INFO, "Cannot parent a QWidget to itself");
      
          if (Q_UNLIKELY(!qobject_cast<QApplication *>(QCoreApplication::instance())))
              qFatal("QWidget: Cannot create a QWidget without QApplication");
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @AndrzejB
      The example, and the error message, is for QApplication. You have put in set(QAPPLICATION_CLASS QGuiApplication). You need QApplication for widget applications. You can see that, and the consequent error message if you do not, in the code you pasted.

      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