Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 458.3k Posts
  • how to convert c++ modelIndex to QML modelIndex?

    Unsolved
    2
    0 Votes
    2 Posts
    340 Views
    J
    ok i make some mistake and fix the code as below: function expandallitem( tindex) { var parenti= (tindex.parent) var parentii= (parenti.parent) var i=getIndexFromCpp(tindex); var index0 = treeViewModel.index(0,0 ) var index1 = treeViewModel.index(i,0 ) expand(parenti) expand(tindex ) sel.select(tindex,ItemSelectionModel.Select) } sel is the selection.. and it is still the expand can work well . and slect is fail to work
  • widget container with custom type

    Unsolved
    4
    0 Votes
    4 Posts
    609 Views
    jsulmJ
    @user4592357 Something like // Base would be QWidget in your case class Base {}; class W1 : public Base {}; class W2: public Base {}; template<typename W> Base* createWidget() { return new W(); } class Container { public: Container(std::function<Base*()> factory) { // Create an instance of the widget Base* widget = factory(); } } Container container1(createWidget<W1>); Container container2(createWidget<W2>); Regarding connections: as long as these widgets have same signals/slots (from base class from example) I don't see any issues. But if they have different signals/slots I don't see how you can do this in a generic way as your container needs to know what these different widgets have.
  • setup file for exe

    Unsolved
    3
    0 Votes
    3 Posts
    508 Views
    jsulmJ
    @Bharth http://doc.qt.io/qt-5/windows-deployment.html http://doc.qt.io/qtinstallerframework/
  • C++ Qt3DExtras::QTorusMesh – cannot be rotated in Z direction

    Solved qt3d
    6
    0 Votes
    6 Posts
    1k Views
    J
    Ok I found what is causing that - the torus is created facing Z. Thanks.
  • XDG Desktop portal in Qt

    Unsolved xdg flatpak
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, Not a direct answer but why not use QDesktopService::openUrl ? Or are you trying to make your app open that file type ?
  • Crashing while turn on/off BTLE adapter

    Unsolved
    13
    0 Votes
    13 Posts
    1k Views
    SGaistS
    By the way, can you give more information about your setup ? (hardware/software)
  • QTreeWidget branch icons

    Unsolved
    1
    0 Votes
    1 Posts
    978 Views
    No one has replied
  • Qtimer on tabs of QTabWidget... not updating?

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    mrjjM
    @David-Jacobson Hi Well if a widget is not shown http://doc.qt.io/qt-5/qwidget.html#visible-prop returns false, there is really no reason to redraw on screen as its just wasted efforts. ( as doc talks about) I think this is what you are seeing.
  • Why does the child widget not resize when I call resize () on parent?

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    X
    @mrjj Yeah! Fantasstic answer!! Thank you very much!:) We close question [EDIT: Expletives removed --JKSH]
  • Window all blacked in OpenGL 3.1

    Unsolved
    7
    0 Votes
    7 Posts
    855 Views
    M
    So this problem is related with my system? can someone run a QOpenGLWidget with my format in their pc?
  • Use QTableWidget in c++ visual studio to display sqlite database contents

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    mrjjM
    Hi and welcome to the forums. You can use the http://doc.qt.io/qt-5/qsqltablemodel.html#details There is sample in the docs of how to hook up the model to the view. There are also other models if showing a table is not what you want. The http://doc.qt.io/qt-5/qsqlquerymodel.html allows to use SQL to select the data. Im not sure what Qtaddon can create regarding UI files. QtCreator can both create a stand alone UI and one that has .h and .cpp also. I assumed its the same with the addon but i have no VS to test it. Does addon offer more than one option for UI file ?
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    7 Posts
    2k Views
    K
    @JKSH Thanks, yes I am aware of this possibility in creator. IIRC I had encouraged you to publish the browser extension for Chrome. Great tool! Basically use it all the time. I have stumbled across a couple of macros without a trace of documentation. Personally I consider as a pity.
  • Return custom widget from QStackedWidget

    Solved
    4
    0 Votes
    4 Posts
    605 Views
    A
    @mrjj Thank you very much!
  • Suddenly unable to compile any examples

    Unsolved
    6
    0 Votes
    6 Posts
    789 Views
    JazzyGuyJ
    I think I am running qmake. Just did a full Creator update and now I can run the calendar example, so maybe it was a bug that got me and was fixed. Time will tell. Perhaps I somehow changed to make from qmake, unsure, but thank you for the tip. FWIW: I had copied and executed the comment in Makefile at the bottom of the top header section, and after then was when my troubles began. That was for a different project. After executing the qmake config command, I was able to build my project successfully from cmd line using make (will try with qmake, thanks for tip) and also from within Sublime Text 3, which I normally use. The examples started to fail to build in Creator after then. Why (if true) did my configuring another project affect Creator? What is the proper way to configure projects for external building outside of Creator that won't affect Creator's operation, if that is what happened? Any hints or advice on those lines much appreciated. Thanks.
  • How many qm files are in rcc file

    Solved
    5
    1 Votes
    5 Posts
    626 Views
    Pablo J. RoginaP
    @KiranRudigi is your issue solved? if so please don't forget to mark your post as such. Thanks
  • How to make QLegend scrollable?

    Unsolved qtchart qlegend qgraphicsview
    1
    1 Votes
    1 Posts
    712 Views
    No one has replied
  • QLineEdit in modal QDialog: cannot enter text.

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    kshegunovK
    @Bart_Vandewoestyne said in QLineEdit in modal QDialog: cannot enter text.: So apparently, somewhere between Qt 4.8.7 and Qt 5.11.3 there is a change in behavior for the QWidget::grabKeyboard() method in combination with modality grabKeyboard is the ultimate "modality" and is very invasive. If you're using it (regularly) it probably means you are doing something you shouldn't be. (or we were doing something wrong and were just lucky in 4.8.7)? It is possible. No way to tell beside boiling it down to an MRE which can be dissected.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • Way to catch non-QApplication window events ?

    Unsolved
    4
    0 Votes
    4 Posts
    500 Views
    dheerendraD
    No direct way to do this in Qt. You need to write this on your own.