Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    37 Views
  • I am searching plugins skeleton

    Unsolved
    8
    0 Votes
    8 Posts
    758 Views
    SGaistS
    To be sure we're on the same idea, you would like to have them at the correct place when you build your application ?
  • Wrong unicode in QKeyEvent

    Unsolved
    5
    0 Votes
    5 Posts
    901 Views
    J
    When I used nativeEvent, I couldn't receive WM_SYSKEYDOWN and WM_KEYDOWN, so it was hard to go further on debugging this issue.
  • pointer is often invalid when dealing with atomic operations

    Unsolved
    5
    0 Votes
    5 Posts
    450 Views
    U
    @SGaist visual studio 2017 / qt creator 4.6.1 qt 5.11.0 windows 10
  • pointer to a function

    Solved
    2
    0 Votes
    2 Posts
    329 Views
    aha_1980A
    @rezaMSLM you need to google for "pointer to member function" to get the correct syntax.
  • How to use Q_GLOBAL_STATIC_WITH_ARGS

    Solved
    4
    0 Votes
    4 Posts
    844 Views
    mrjjM
    @JohnGa Why not just make SubWindow*childWindow=0; a member of the mainwindow and do if (! childWindow) childWindow= new SubWindow(ui->mdiArea); That way, you will only create it once. and no need for macros and singleton pattern etc.
  • QSqlRelationalDelegate display all possible values from foreign key

    Solved qt5 qsqlrelational
    2
    0 Votes
    2 Posts
    629 Views
    D
    Hi again ! It seems that by looking still a bit more I found a suitable answer. The key was to set the QSqlRelationalDelegate for the mapper and not the QComboBox but still setting the model of the QComboBox to the table containing all the functions. Here is my final code: //Init all private members //Init all private members price1 = new QDoubleSpinBox(this); price2 = new QDoubleSpinBox(this); price3 = new QDoubleSpinBox(this); price4 = new QDoubleSpinBox(this); function = new QComboBox(this); mapper = new QDataWidgetMapper(this); sqlModel = new QSqlRelationalTableModel(this); QSqlTableModel *fctModel = new QSqlTableModel(this); QListView *articlesView = new QListView(this); //Imediately links the views and the models sqlModel->setTable("Articles"); //A few indexes int nameIndex = sqlModel->record().indexOf("Name"); int priceIndex = sqlModel->record().indexOf("sellPrice"); int jobShareIndex = sqlModel->record().indexOf("jShare"); int bPriceIndex = sqlModel->record().indexOf("bPrice"); int redPriceIndex = sqlModel->record().indexOf("reducedPrice"); int functionIndex = sqlModel->record().indexOf("function"); int functionNameIndex; { auto tmp = new QSqlTableModel(); tmp->setTable("Functions"); functionNameIndex = tmp->record().indexOf("name"); delete tmp; } //Configures the sql model sqlModel->setRelation(functionIndex, QSqlRelation("Functions", "Id", "name")); sqlModel->setEditStrategy(QSqlTableModel::OnFieldChange); sqlModel->select(); //Views articlesView->setModel(sqlModel); articlesView->setModelColumn(nameIndex); //Sets the column to the name articlesView->setEditTriggers(QAbstractItemView::NoEditTriggers); function->setModel(sqlModel->relationModel(functionIndex)); function->setModelColumn(functionNameIndex ); //Mapper mapper->setModel(sqlModel); mapper->addMapping(price1, priceIndex); mapper->addMapping(price2, bPriceIndex); mapper->addMapping(price3, jobShareIndex); mapper->addMapping(price4, redPriceIndex); mapper->addMapping(function, functionIndex); mapper->setItemDelegate(new QSqlRelationalDelegate(mapper)); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); I hope that it will be able to help anybody who might encounter that same problem ! Happy new year everybody, take care ! :)
  • Double-click a QTableWidget or QTreeWidget makes the new dialog minimized

    Solved
    15
    0 Votes
    15 Posts
    2k Views
    M
    @mrjj Done https://bugreports.qt.io/browse/QTBUG-72801
  • What can and can't you do in a QJSEngine function?

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    SPlattenS
    I modified my script to add a try/catch clause around the call to raise. This resulted in an error being displayed, char* was an issue, no idea why: Error: Unknown method parameter type: char* I then edited the code and changed the char* parameter for QString. It now works, I've no idea why it didn't like char*.
  • QEventLoop: Cannot be used without QApplication Qt static

    Unsolved
    30
    0 Votes
    30 Posts
    13k Views
    M
    @hskoglund Thanks for the reply. Will check the plugins built with Qt static and see if it built with success.
  • Access object from multiple UI classes

    Solved signals & slots parent & child ui object
    7
    0 Votes
    7 Posts
    2k Views
    Pl45m4P
    @mrjj If it works with setters, it should be fine. I'm relatively new to Qt and since you have signals and slots, I thought using setters is maybe not the best way, so there MUST be another solution :) haha Ok I will try it out tomorrow and let you know if it worked for me :) EDIT: @mrjj @SGaist Thank you guys, passing the pointer to my data with constructor and setting the data to a local member to use it inside my WindowChildClass worked for me.
  • Fastest way to select lots of items in QTreeView programatically?

    Unsolved qitemselection
    4
    0 Votes
    4 Posts
    1k Views
    Chris KawaC
    I found out the hard way that for large selections using the QItemSelectionModel::Rows option is a massive performance killer. The algorithm for extending the selection doesn't seem to be very good. I had a case where manually creating QItemSelection with items for all columns and then selecting it in one call without that flag gave me even 30x boost. Give it a try.
  • MinGW 7.3.0 for Qt 5.12.0 missing

    Solved
    3
    0 Votes
    3 Posts
    884 Views
    NiagarerN
    @mrjj Thank you, worked! 10/10
  • How programically order tabs in QTabWidget?

    Solved
    3
    0 Votes
    3 Posts
    355 Views
    mrjjM
    Hi From code you could use https://doc.qt.io/qt-5/qtabbar.html#moveTab via tabwidget->tabBar()
  • Adding a custom-widget popup to a QToolButton in a QToolBar

    Unsolved
    2
    0 Votes
    2 Posts
    368 Views
    mrjjM
    Hi I think you have to do it manually - as far as i know it cant be turned into a popup. You might to install an event filter on the custom widget to catch if user clicks outside so it can auto close.
  • Possible to enable depth buffer for openGL painter?

    Unsolved
    2
    0 Votes
    2 Posts
    460 Views
    B
    I think the easiest way to do what I want is render it into an FBO texture and draw it on a quad. If i'm using opaque rectangles I could draw a blank quad before the 3d scene and let the 2d painter fill it in at the very end as well.
  • How to create the plugin of MARIADB for Qt5

    Solved
    20
    0 Votes
    20 Posts
    9k Views
    C
    @blackout69 I follow your step to build static mysql but got fail 0: set mysql=c:\mysql 1: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers 2: qmake sqldrivers.pro 3: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql 4: qmake -- MYSQL_INCDIR=C:\mysql\include "MYSQL_LIBDIR=C:\mysql\lib" MYSQL_LIBS="-lmariadbclient" got error after this step Project ERROR: Library 'mysql' is not defined. 5: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers 6: qmake -- MYSQL_INCDIR=C:\mysql\include "MYSQL_LIBDIR=C:\mysql\lib" MYSQL_LIBS="-lmariadbclient" no error after this step 7: nmake sub-mysql got error after this step NMAKE : fatal error U1073: 不知道如何生成“sub-mysql” Stop. ( NMAKE : fatal error U1073: don't know how to generate “sub-mysql” Stop.) could you help me to correct the steps? I don't know which step or path is wrong. Many thanks .
  • QTableView::stretchLastSection interferes with QTableView::resizeSection

    Solved
    2
    0 Votes
    2 Posts
    440 Views
    deisikD
    It seems I have fixed this issue by setting minimumSectionSize equal to 21
  • Connect Qt GUI with ROS

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    jsulmJ
    @Agricola I'm not an ROS expert, but as far as I can see ROS is running on the robot itself, not the client software controlling a robot. There are client libraries you can use to remotely controll your robot (you can use these client libraries in a Qt application if there is a C or C++ library). You need to download first from http://www.ros.org/install/ and read documentation/tutorials.
  • Push Button -> Label, setText not refreshing under MacOS

    Solved
    5
    0 Votes
    5 Posts
    3k Views
    B
    Ok thanks, I downgraded to 5.10. pip3 install PyQt5==5.10