Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.4k Posts
  • passing signal between threads with Qvector as parameter

    Solved
    13
    0 Votes
    13 Posts
    1k Views
    Christian EhrlicherC
    @JonB said in passing signal between threads with Qvector as parameter: might be because connect() refuses to accept them for queueing. correct
  • Need help with .pro file, copy files at build

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    A
    @Archie888 said in Need help with .pro file, copy files at build: @Paul-Colby Thanks for the tip to the right direction, very helpful!! The .qrc was a mistake, meant .pro, sorry. QMAKE_SUBSTITUTES seems like an interesting cross-platform way to copy files to the build destination from project, and it worked, thanks. However, having to have the .in extension creates issues, having to create a copy automatically with .in and so on, which I can do, but it's not very elegant. But I will definitely keep that in mind. As I checked into the issue again, I now finally got QMAKE_SUBSTITUTES working to run the .bat file, but it needs to be like this: QMAKE_POST_LINK += $$PWD/my_batch_file.bat Unlike with OTHER_FILES, it needs the $$PWD/ as the starting point. Also, no cmd window is opened unlike I was expecting. The execution will be part of the Qt build process, and any echo ouput in your .bat file is shown in the Compile Output tab. However, now I am running into problems with getting access denied with copying with the .bat, so I will have to look into this issue later. Here is the .bat again, which is giving the : @echo off setlocal set BUILD_DIR=%1 set SOURCE_DIR=%~dp0A8NodeAssistant echo Copying A8NodeAssistant folder from %SOURCE_DIR% to %BUILD_DIR%... xcopy /s /e /y %SOURCE_DIR% %BUILD_DIR%\ pause Any help appreciated of course what the mystery could be, if someone has info at the tip of the fingers, but I'll get into this later again myself. Cheers! (I might have to implement the nasty .in file generator in the end, LOL!) Typo on the line: "As I checked into the issue again, I now finally got QMAKE_SUBSTITUTES working to run the .bat file, but it needs to be like this:" Meant: "As I checked into the issue again, I now finally got QMAKE_POST_LINK working to run the .bat file, but it needs to be like this:" It seems that the time period to edit comments here has been decreased.
  • QProcess and cmd.exe not working when path with with accented characters

    Unsolved
    8
    0 Votes
    8 Posts
    515 Views
    V
    @ChrisW67 With QFile:copy() I'm unable to access deeppath as I mentioned previously and that is the reason why I use cmd.exe. So I returned to my own code and changed the text picked up using lineEdit : < void MainWindow::on_lineEdit_returnPressed() { if (process->isOpen()) { QString s = ui->lineEdit->text() + "\n"; QTextCodec* codec = QTextCodec::codecForName("IBM-850"); QByteArray ba = codec->fromUnicode(s); } /> And now all is working correctly! 'I tried first with dir ["longpath with accented characters"] and it works...
  • Database performance 5 times faster with Access than with MS SQL

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    JonBJ
    @Andy314 Yep :) I guess you can assume the Access driver maybe does some forward optimization for you, in some shape or form. IIRC the MS SQL driver is the most sensitive to/affected by forward-onlyness, more so than e.g. MySQL. But it's always worth adding Qt's forwardOnly, makes one think maybe it should have been default as there is probably much code out there doing just forward queries and not realizing how much the default is penalising them.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Remove empty lines - unsolved repost (AGAIN)

    Unsolved
    4
    0 Votes
    4 Posts
    241 Views
    kkoehneK
    @AnneRanch , if you're talking about Qt Creator: ClangFormat has an option 'MaxEmptyLinesToKeep'. you can set it to 0, and then enable reformatting of your file (e.g. by selecting 'Full formatting' and 'Format edit code on file save' in Preferences > C++ > Code Style. This will also apply the other formatting rules though, which might or might not be what you want ...
  • Scrollbar main window

    16
    0 Votes
    16 Posts
    19k Views
    M
    @JonB I couldnt go to Designer in my actual app because my content was generated dynamically. What I wrote here was for testing. And yes I did indeed end up using layouts, giving them to contentWidget and made that a widget of scrollArea. Then set scrollArea as central widget. But I had a button whose geometry I couldnt quite set within layouts, so I separately added it to scrollArea through setParent and set its geometry from there. Thank you
  • toLatin() method replaces apostrophe and double quotes with ?

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    kkoehneK
    @Paul-Colby said in toLatin() method replaces apostrophe and double quotes with ?: Edit: If I remember correctly, older Qt versions used to use QString::qUtf8Printable() for qDebug() output, but as per the docs: This is equivalent to str.toUtf8().constData(). So it ends up the same anyway :) qUtf8Printable() is still actually used with qDebug() ... but in a different place: Use it if you want to use the "printf-style" API of qDebug, which expects utf-8 encoded strings for %s. E.g. QString str = "..."; qDebug("Output: %s", qUtf8Printable(str)); This is different from system printf, which expects the local 8 bit encoding by default, so you better use qPrintable()/.toLocal8Bit().constData(): QString str = "..."; printf(stdout, "Output: %s", qPrintable(str)); But yeah, there's still no guarantee that the printed string will actually also show up correctly if printed on console , as Windows has it's own limitations there ...
  • 0 Votes
    4 Posts
    877 Views
    sierdzioS
    @trusktr said in Auto re-run property bound code in C++ outside of a class?: @sierdzio Have a look at Solid.js. People are loving the dependency-tracking reactive patterns. What does that have to do with me? ;-) What is the Qt equivalent of moving state outside of a QML component and both: logging it when it changes rendering it inside two different compoments ? Typically this involves creating a C++ object which holds the state, has properties and signals etc. This solves both of your points nicely and keeps UI and logic nicely separated.
  • How to properly disconnect from OPC-UA

    Unsolved
    1
    0 Votes
    1 Posts
    184 Views
    No one has replied
  • STOP Running Ongoing Launched Command by Clicking On a Button

    Unsolved
    4
    0 Votes
    4 Posts
    293 Views
    S
    @Gabrielli-Alanio said in STOP Running Ongoing Launched Command by Clicking On a Button: connect(OProcess,SIGNAL(stopserver()),this,SLOT(FinishProcess())); QProcess is a class. Instead, connect() expects a pointer to an object as a first argument. stopserver() seems to be a signal of MainWindow. Hence, this means the first parameter needs to be of type MainWindow*. You don't implement signals! In Qt signals are declared. moc will then generate the implementation. It is important that your class directly or indirectly inherits QObject. And also don't forget the Q_OBJECT macro at the top of your class. This is all important for signals to work. ui->btn_stop->click() simulates a mouse click on the button. However, QPushButton has a signal clicked() which you need to connect somewhere to react to the button being clicked. Since Qt 5 there is the new connect syntax which would give errors at compile time. Your connect statement might give an error because of QProcess, but more errors during runtime. Use something like connect(this,&MainWindow::stopserver,this,&MainWindow::FinishProcess); instead. Though this is not exactly what you want. See the advice from @mpergand as well.
  • Visualize Realtime pointclouds on QT widget

    Moved Unsolved qt5 widget pcl vtk
    6
    0 Votes
    6 Posts
    2k Views
    S
    @ZaidX said in Visualize Realtime pointclouds on QT widget: I dont understand what do you mean by "if its pure qt without any hardware accleration" . With this I mean that you derive from QWidget and implement paint() using QPainter. This is comparatively slower than OpenGL or Vulkan. For these you need a QOpenGLWidget or QVulkanWindow. This then allows to use OpenGL or Vulkan directly for drawing while still using Qt for everything else (including mouse handling). @ZaidX said in Visualize Realtime pointclouds on QT widget: Bandwith: 3.55MB/s Frequency: 4.9Hz This sounds doable. Though it doesn't mean it is easy to reach interactive speeds.
  • Force QScrollView to re-calculate scrolling range

    Solved
    7
    0 Votes
    7 Posts
    414 Views
    alik_coA
    @ChrisW67 Thanks! That did it: void init(bool largeFont) { _font = UIProperties::instance().fontMonospace(); if (largeFont) { _font.setPointSize(std::round(font().pointSize() * 1.5)); } QFontMetrics metrics(_font); QRect r = metrics.boundingRect("Qwerty"); _lineHeight = r.height() + 4; _totalHeight = _lineHeight * int(_entries.size()); resize(size().width(), _totalHeight); // <<== FIX_FIX }
  • QLayout Memory Management

    Unsolved
    5
    0 Votes
    5 Posts
    379 Views
    M
    @FuzzieTheWarg said in QLayout Memory Management: it states that calling setLayout() is an alternative to passing the widget to the layout's constructor Good point, it was unclear to me. Anyway, i perfer setLayout() because in many cases we use 'this' (the root object) as parent when creating new objects, but it can be the wrong one for layouts and so error prone.
  • When to use QWidget x QFrame as container?

    Solved
    11
    0 Votes
    11 Posts
    5k Views
    R
    Thank you all for the explanation, i was using QFrame in all cases, looks like there are cases that QWidget is a better choice, like when you dont plan to draw anything on its background neither use anything from a specific class as SGaist mentioned!
  • Segmentation fault when deleting table model data

    Solved
    7
    0 Votes
    7 Posts
    727 Views
    T
    @SGaist Ahh - it works! Thanks for quick feedback.
  • Accessing the currently used editor of a QTableView

    Unsolved
    8
    0 Votes
    8 Posts
    550 Views
    SGaistS
    @JonB well, that I don't know as I wasn't present when the brainstorming about that class happened (-:
  • Widgets not Expanding

    Unsolved
    3
    0 Votes
    3 Posts
    256 Views
    MasterQM
    @mpergand said in Widgets not Expanding: _tabulator->setLayout(layout); I hope, I not got you wrong. It is now auto index = _parent->addTab(_tabulator, _tabulatorname); QVBoxLayout *layout = new QVBoxLayout(_parent->widget(index)); layout->addWidget(_tableview); _tabulator->setLayout(layout); but I do not see any difference in behaviour. _tableview still not expanding. --EDIT-- sry, I am wrong. The table now is expanding. I was confused since the header and rows are not adapting to the table size. But that's another story!
  • Qt on Haiku OS?

    Unsolved
    2
    0 Votes
    2 Posts
    391 Views
    cristian-adamC
    See https://discuss.haiku-os.org/t/the-next-generation-of-qt-6-is-now/10178 Apparently you can have the Qt Telegram client built: [image: 9b6c7ad52d1b31293d37bffe8661f27b289c49bc.jpeg]
  • QLayoutItem can't be deleted if it's a layout

    Unsolved
    7
    0 Votes
    7 Posts
    412 Views
    S
    @jsulm delete child->widget(); // delete the widget delete child; // delete the layout item These two lines implies that child and child->widget() are different; but it's not the case for QLayout.