Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • Qt Installed but it does not work

    Unsolved
    5
    1 Votes
    5 Posts
    2k Views
    SGaistS
    Hi, You should concentrate on what @JonB wrote, your current issue is that your distribution is too old to run that version of Qt Creator. Either install a previous one, the one coming from your distribution or build Qt Creator yourself with Qt 5.
  • Format content of messageBox

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    C
    @mpergand said in Format content of messageBox: msg.setFont(QFont("courier")); Thank you so much It is working now after I used msg.setFont(QFont("consolas"));
  • Using QtConnurrent with lambda

    Unsolved
    10
    0 Votes
    10 Posts
    3k Views
    KroMignonK
    @AnneRanch said in Using QtConnurrent with lambda: Let me put it this way I do RTFM and post what is said ability using lambda. I post the error. IMHO the error shroud be enough to lead me to the fix. The " start from how the world created" seem to be standard "answer". Let me answer this way, I never requests you to RTFM, the only thing I was trying to do was to improve your knowledge about lambda functions in C++. Which is, in my eyes, the first step before trying to use them. I have given you a link to a well done explanation about how to use lambda in C++, which is much better a trying my self to do it. My English is not fluent enough to explain it in a better way. So, if you had taken time to learn how to use lambda, you had found quickly why you got this error. But this seems to be hard for you. I am always stomach by people who want to program but don't want to learn how to it. And which are always becomes aggressive when someone point out their lake of comprehension. I am always pleased when someone gives me an explanation or links where I can find useful information to understand how to do what I want to do.
  • QWidget subclass setSurfaceType(...)

    Solved
    2
    0 Votes
    2 Posts
    544 Views
    EntropySinkE
    Sometimes just asking the question brings the answer. I added a plain QWidget 'receptacle' in the .ui, then in my own mainwindow code I foist a layout on it holding my vulkan-equipped subwidget. ui_->setupUi(this); auto* vw = new QVulkanWindow{}; ... auto* layout = new QVBoxLayout{}; layout->addWidget(QWidget::createWindowContainer(vw)); ui_->receptacle->setLayout(layout);
  • About QJsonObject: the order of the inserted items is not preserved

    10
    3 Votes
    10 Posts
    10k Views
    JonBJ
    @JKSH said in About QJsonObject: the order of the inserted items is not preserved: The implementation does affect performance. True, but I don't think that is what the OP or @Robert-Hairgrove is asking about/for. They are talking only about the serialization to file ordering, for inspection, not the in-memory behaviour. They would be happy if the former could be controlled/altered without impacting the latter. Mind you, I don't know if that is practical/possible. I believe the OP at least was asking for insertion order to be maintained....
  • QGraphicsItem bad item drawing

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    JonBJ
    @Loc888 Correct principle. There is no reason for rect().width()+13. Unless you have altered anything I think you should have: void Rectangle_Item::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter->drawText(QRect(rect().x(), rect().y() - 12, rect().width(), 12 /* altered*/), "NONE"); painter->drawRect(rect()); } and QRectF Rectangle_Item::boundingRect() const { return QRect(rect().x(), rect().y() - 13, rect().width() /* altered*/, rect().height()+13); }
  • 0 Votes
    2 Posts
    4k Views
    K
    OK, it was a bit premature to ask immediately. I found this post https://forum.qt.io/topic/54438/solved-qt-5-4-1-qtimer-using-up-all-handles-for-window-manager-objects Actually with QNetworkAccessManager I was a bit sloppy. Need to check if it helps already. Edit[koahnig]: It helped. Therefore, pay attention when generating new QNetworkAccessManger objects.
  • Ball creation at regular intervals, falling ball game

    Unsolved
    4
    0 Votes
    4 Posts
    502 Views
    JonBJ
    @Iftekhar Before you get that far, I would completely rethink your class Sprite : public QTimer class. Subclassing should be thought of/subject to the "is-a" test: is a sprite a (kind of) timer? A sprite is an object you draw, which maybe has a position which changes over time. You have it as an instance/subclass of a QTimer, with a draw() method to draw it. This seems completely unsuitable, and the wrong way round. If anything a sprite should be a QWidget or a QObject, perhaps with a QTimer as a member; or the QTimer might be better external to the sprite. void MainWindow::paintEvent(QPaintEvent *) { QPainter painter(this); // ... emit draw(painter); } I don't think you should be emitting any signal here, nor pass it a QPainter. I think I would just have a list of all the ball-sprites in existence. A single QTimer which, each time it ticks, causes code to go through the list and update the positions of every sprite. (Unless you want accuracy/timing/movement on each ball separately, so they don't all move at the same time: in that case you might put a QTimer into each sprite, but it would not be my inclination.) You can then also use that same timer to cause a new sprite to be created and added to the list, by checking if the current tick is at one of the "regular intervals" for creation. Or, if you prefer, have a second timer ticking just for new ball creation. We end up with either one QTimer or two, no matter how many sprites there are. If your whole objective is to have an area showing a number of "balls" moving around, I would be tempted to change over to using a QGraphicsScene + QGraphicsView. Then your Sprites can be subclassed from QGraphicsEllipseItem. You can then create, remove and move them easily. I could also mention the possibility of using QAnimation to automate smooth movement of objects; but that may be a step further than you want.
  • Qt online installer fails in Ubuntu 18.04

    Solved
    10
    0 Votes
    10 Posts
    5k Views
    JKSHJ
    @CroCo said in Qt online installer fails in Ubuntu 18.04: Never mind. I've solved it by running 5.12.x Offline Installer which contains Qt Creator 5.0.2 which is enough for me. I'm glad to hear that you solved your problem. If you want Qt Creator 5.0.3, you can get the standalone installer from https://download.qt.io/official_releases/qtcreator/5.0/5.0.3/ But I found it odd Qt forces me to install Qt Creator 7 yet it is not compatible with Ubuntu 18.04. It would be nice if the installer also provides options for different Qt Creator versions. I agree
  • Move rows in custom model

    Solved
    3
    0 Votes
    3 Posts
    669 Views
    Please_Help_me_DP
    Oh, it seems that in qColadaH5Model::moveItem I should have determine parentIndex only after rows are removed i.e. after endRemoveRows(). Because there are cases when this index is changed after removing rows and thus it becomes invalid. Probably I should have implement takeRow and insertRow instead of moveRow: I would not spend few days for searching this bug By the way QAbstractItemModelTester is very helpful and pretty easy to use.
  • error: static assertion failed: Signal and slot arguments are not compatible

    Unsolved
    6
    0 Votes
    6 Posts
    4k Views
    I
    @Chris-Kawa I have already overridden the paintEvent() in the Mainwindow class. Please refer to this post and provide some help https://forum.qt.io/topic/135315/ball-creation-at-regular-intervals-falling-ball-game/2
  • QLocale doesn't match system locale

    Solved qlocale locale qdatetime
    4
    0 Votes
    4 Posts
    905 Views
    T
    I found the error. From docs here: https://doc.qt.io/qt-6/qdatetime.html#toString it is reported Note: Day and month names as well as AM/PM indication are given in English (C locale). If localized month and day names and localized forms of AM/PM are used, use QLocale::system().toDateTime(). Correct way to use system locale or a desired locale is qInfo().nospace() << QLocale::system().toString(QDateTime::currentDateTime(), "dd MMMM yyyy hh:mm:ss.zzz");
  • QTableView QStyledItemDelegate sizeHint() not called

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    Axel SpoerlA
    You are right, you have to specify the column/row as an additional parameter, sorry about that.
  • How to determine QWebEngineView timeout?

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    P
    https://stackoverflow.com/questions/12334560/qt-qwebview-network-timeout-values-and-signals
  • Can't add menu to QSystemTrayIcon

    Solved
    7
    0 Votes
    7 Posts
    800 Views
    S
    @JonB yeah, that's exactly what I've done. Thanks for your help :)
  • FYI QtConncurrent - partially solved - CLOSED

    Unsolved
    1
    0 Votes
    1 Posts
    95 Views
    No one has replied
  • help with legacy opengl

    Unsolved
    4
    0 Votes
    4 Posts
    575 Views
    SGaistS
    Hi, From the looks of it, the QOpenGLFunctions class is likely what you are looking for in combination with QOpenGLWidget. With both together, you should be able to reuse what you already have.
  • qt Ethernet communication

    Unsolved
    3
    0 Votes
    3 Posts
    347 Views
    Y
    @jsulm thank you very much i'll check it .
  • 0 Votes
    6 Posts
    27k Views
    X
    hello.. I solved the problem by installing dependencies as described in below link. https://web.stanford.edu/dept/cs_edu/resources/qt/install-linux my OS is Xubuntu 20.04
  • Need to build QT GUI using my C++ code. I want to be more C++ and less QT. Please advise

    Unsolved
    17
    0 Votes
    17 Posts
    1k Views
    D
    Just use the designer to create .ui files for the dialogs you need. There is a simple API to load these files as a class and every control has simple method for setting/reading it's value. Requires very little code.