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. Difference with QFileDialog between static and dynamic build on Xubuntu
Forum Updated to NodeBB v4.3 + New Features

Difference with QFileDialog between static and dynamic build on Xubuntu

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 168 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.
  • F Offline
    F Offline
    FLdev
    wrote on last edited by FLdev
    #1

    I have a class that looks like the following:

    class TestSaveDialog : public QWidget
    {
        Q_OBJECT
        QML_ELEMENT
    public:
        Q_INVOKABLE void openFile()
        {
            QString filename =  QFileDialog::getSaveFileName(
                this,
                "Save configuration",
                "/home",
                "Conf files (*.conf)");
    
            if( !filename.isNull() )
            {
                qDebug() << "selected file path : " << filename.toUtf8();
            }
        }
    };
    

    I have Qt 6.5.2 built from source as both a static and dynamic library. When I build my application against the dynamic library and call openFile of my class I get a GTK3 type save dialog which is what I would like. When I build against the static library I get the more old school looking GTK2 type save dialog. Any thoughts on how to get the GTK3 type save dialog when building against the static library?

    F 1 Reply Last reply
    0
    • F FLdev

      I have a class that looks like the following:

      class TestSaveDialog : public QWidget
      {
          Q_OBJECT
          QML_ELEMENT
      public:
          Q_INVOKABLE void openFile()
          {
              QString filename =  QFileDialog::getSaveFileName(
                  this,
                  "Save configuration",
                  "/home",
                  "Conf files (*.conf)");
      
              if( !filename.isNull() )
              {
                  qDebug() << "selected file path : " << filename.toUtf8();
              }
          }
      };
      

      I have Qt 6.5.2 built from source as both a static and dynamic library. When I build my application against the dynamic library and call openFile of my class I get a GTK3 type save dialog which is what I would like. When I build against the static library I get the more old school looking GTK2 type save dialog. Any thoughts on how to get the GTK3 type save dialog when building against the static library?

      F Offline
      F Offline
      FLdev
      wrote on last edited by FLdev
      #2

      For anyone else encountering this issue, what was required in the CMakeLists.txt was

      qt_import_plugins(application-gui INCLUDE Qt::QGtk3ThemePlugin)
      

      as well as making sure the following packages were installed when building the static libraries and making sure to do a completely clean build after installing them.

      sudo apt-get install libgtk-3-dev libglib2.0-dev
      
      1 Reply Last reply
      1
      • F FLdev has marked this topic as solved on

      • Login

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