Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Qt5 C++ Printing status

    Unsolved hello
    3
    0 Votes
    3 Posts
    313 Views
    artwawA
    @devman There is no Qt interface for that. Qt (via QPrinter) sends the job to the printer subsystem of the OS and that's it. You can, however, query the state of the printer (see QPrinter documentation!) and thus derive some assumptions. Any other solution would not be platform agnostic, you'll need to interface yourself with the respective printer subsystem.
  • Connection string for ODBC / Microsoft SQL Express

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    M
    Can you connect to it via another ODBC client (i.e., one not based on Qt)?
  • Is it possible to display 'float64' .tif images in PyQt5 window?

    Unsolved
    7
    0 Votes
    7 Posts
    649 Views
    J
    Yes .tif gathered from UAVs depicting land...with georeferencing...
  • QListWidget drag/drop documentation/behaviour

    Unsolved
    25
    0 Votes
    25 Posts
    5k Views
    VRoninV
    @JonB said in QListWidget drag/drop documentation/behaviour: I don't know how that compares against your ui->listWidget->setDragDropMode(QAbstractItemView::DragOnly) setDragDropMode calls setAcceptDrops so either works
  • QRadioButton and QGroupBox

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    JoeCFDJ
    @SPlatten For example: you lay out 5 radio buttons in a group box: 3 are mutually exclusive and the other two are the same. In this case, you need two qbuttongroups for the three and two radio buttons. If all five are mutually exclusive, qbuttongroup is not needed. The buttons in a button group are usually checkable QPushButtons, QCheckBoxes (normally for non-exclusive button groups), or QRadioButtons. https://doc.qt.io/qt-5/qbuttongroup.html#details
  • How to get layout type from base class?

    Solved
    5
    0 Votes
    5 Posts
    362 Views
    SPlattenS
    @jsulm , I like that idea: QFormLayout* pobjForm(qobject_cast<QFormLayout*>(pobjLayout)); QGridLayout* pobjGrid(qobject_cast<QGridLayout*>(pobjLayout)); QHBoxLayout* pobjHBox(qobject_cast<QHBoxLayout*>(pobjLayout)); QVBoxLayout* pobjVBox(qobject_cast<QVBoxLayout*>(pobjLayout)); Simple and elegant.
  • How QScrollArea repaints QWidget on it?

    Solved
    5
    0 Votes
    5 Posts
    365 Views
    M
    Quick dirty example: class BigWidget : public QWidget { void paintEvent(QPaintEvent *event) { QPainter painter(this); auto reg = visibleRegion(); int w=80; QSize s{w,w}; QPoint pv=reg.boundingRect().topLeft(); QRect rv(pv,s); while(reg.intersects(rv)) { painter.drawRect(rv); painter.drawText(rv, Qt::AlignCenter,QString("%1,%2").arg(rv.x()).arg(rv.y())); QPoint ph=pv+QPoint(w,0); QRect rh=QRect(ph,s); while(reg.intersects(rh)) { qDebug()<<rh; painter.drawRect(rh); painter.drawText(rh, Qt::AlignCenter,QString("%1,%2").arg(rh.x()).arg(rh.y())); ph+=QPoint(w,0); rh=QRect(ph,s); } pv+=QPoint(0,w); rv=QRect(pv,s); } } };
  • Problem with connect

    Solved
    11
    0 Votes
    11 Posts
    826 Views
    V
    i fixe my bug ! i create the object barreCalcul on the function but, the object as sub after and the pointer is not valid. I need to creat the object at out of my class for don't crash.
  • QtCreator: Build environment variables from script? ...

    Solved
    3
    0 Votes
    3 Posts
    393 Views
    idlefrogI
    @jsulm Didn't notice that option. It's a possibility, thanks. I have a bash file scripts that set only 40 variables for each project version. Although, I don't want to have to do that for every project version. e.g. v1.03.51r, v2.0.5b, and so on.. Many thanks @jsulm ...looks like that's as good an option I'm going to find, although I may just create QtCreator launch scripts for each version. e.g. qt_launch_v1.03r.sh qt_launch_v2.0b.sh I appreciate your help!
  • High DPI scaling detection

    Solved
    8
    0 Votes
    8 Posts
    3k Views
    J
    Update: The font size of the QMenu and the QTabBar do not differ in the main windows constructor. But after waiting for the followup events to be processed these fonts differ in fact. To get the QTabBar having the same font size as the QMenu it doesn't help to just assign the menus font to the it. It is necessary to explicitly assign the pointSize to the font before assigning it to the destination widget (here the QTabBar). Additionally one can get the QFontMetrics::height() for concrete values. I mark this solved. Best Jazzco
  • Qt can not show widget with opacity

    Unsolved
    4
    0 Votes
    4 Posts
    342 Views
    C
    You possibly need a compositor (Compton/Picom or the like) for translucency to work. You may also need a window manager even if there is only one window. These can all be launched from your Xsession script.
  • using latest QMAKE binary with old qt ver

    Unsolved
    4
    0 Votes
    4 Posts
    292 Views
    jsulmJ
    @orio said in using latest QMAKE binary with old qt ver: i dont realy think i can solve bug in a very old qmake version And you also can't use qmake from one Qt version with another one. But again: try with latest Qt4 version, maybe that one works with the symlinks.
  • QT dynamic library in vs2019 environment

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    C
    The same way you link any other C++ dynamic library in VS2019. Putting "QT" in front does not make it magically different.
  • Trying to send 2 signals to different methods when button clicked and start in parallel

    Unsolved
    3
    0 Votes
    3 Posts
    281 Views
    jsulmJ
    @john_hobbyist said in Trying to send 2 signals to different methods when button clicked and start in parallel: Any ideas? https://doc.qt.io/qt-5/thread-basics.html "Any ideas? Is thread programming the only way ?" - could be. It is not really clear what you are doing. If you have long lasting task and don't want to block main thread, then yes, threads are the way to go.
  • C++ DLLs as plugins in Qt

    Solved
    6
    0 Votes
    6 Posts
    672 Views
    K
    Okay, got a working (WINDOWS) solution, probably not perfect but oh well. .h file typedef double(*CalcFunction)(double); std::vector<CalcFunction> m_Plugins; void loadPlugins(); .cpp file void ImageMetrics::loadPlugins() { m_Plugins.clear(); QDir directory(QDir::currentPath()); directory.cd(QString("Plugins")); auto path = QDir::cleanPath(directory.path()); SetDllDirectoryA(path.toStdString().c_str()); QStringList plugins = directory.entryList(QStringList() << "*.dll", QDir::Files); foreach(QString plugin, plugins) { QLibrary lib(plugin); CalcFunction calc = (CalcFunction)lib.resolve("calc"); if (calc){ m_Plugins.push_back(calc); qDebug() << m_Plugins.back()(25); } else qDebug() << lib.errorString(); } } PSA if other get stuck and find their way here: Make sure your DLLs match your Qt Creator architecture (I was using 32 bit DLLs with 64 bit Creator. Your DLL functions have to be wrapped in extern "C" __declspec(dllexport) (I didn't have the extern part)
  • 0 Votes
    1 Posts
    228 Views
    No one has replied
  • Build project on Windows

    Solved
    4
    0 Votes
    4 Posts
    323 Views
    P
    @mchinand Thanks :D
  • Screen sharing over USB in Qt

    Unsolved desktop ios ipad qt6
    2
    0 Votes
    2 Posts
    552 Views
    SGaistS
    Hi, On macOS you have that option integrated through Sidecar. On Windows, there are several possibilities existing. Do you really want to re-implement that ?
  • Stylesheet for QMenu leaves a white spot at the end

    Solved
    6
    0 Votes
    6 Posts
    448 Views
    S
    Hi @Pl45m4, thanks for your response. I will play around with it, untill I find how I want it to be. Thanks for your answer.
  • Cannot conect to MySql server

    Solved qtsql cmake ubuntu
    5
    0 Votes
    5 Posts
    1k Views
    Christian EhrlicherC
    I was asking for the exact Qt version because of this: https://bugreports.qt.io/browse/QTBUG-97054