Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QPainter effects removed when rendering a QOpenGLWidget into a QPixmap

    Unsolved
    8
    0 Votes
    8 Posts
    958 Views
    C
    If possible, I'm hoping to get an explanation about the 2nd solution, because I stumbled upon it while experimenting. I have never used OpenGL, but I'm interested in why calling grabFrameBuffer() and disabling OpenGL before calling render fixes the problem (I'm not even sure it does fix it)? I read that grabFrameBuffer() relies on glReadPixels(), and read its documentation, but it's still unclear to me. I also took a look at grabFrameBuffer source code to try and see if I can replicate what it's doing without calling it, but failed to understand that as well. I'm just trying to learn something new, so it's not a problem I'm facing or an urgency. Thanks if anyone decides to look into this!
  • it is showing error

    Unsolved
    5
    0 Votes
    5 Posts
    272 Views
    C
    @Pappu-Kumar-Keshari First, you need to heed the warning your compiler is probably giving you: dbmanager.cpp: In member function ‘bool DbManager::saveToSqlite(const QString&)’: dbmanager.cpp:219:1: warning: no return statement in function returning non-void [-Wreturn-type] 219 | } | ^ The code compiles and runs with no error message like: Getting error when saving file from QML to Sqlite. Error like this =>Property 'saveToSqlite' of object QObject(0x7ffcfa692910) is not a function The GUI disappears when I click on any of the buttons, does not exit, but also does not save anything into the people table. This is the limit of the effort I can put into debugging your code. Linux, Qt 6.4.2, GCC 11.4
  • Doubts about QGraphicsView fitInView method

    Unsolved
    5
    0 Votes
    5 Posts
    642 Views
    Z
    @JonB said in Doubts about QGraphicsView fitInView method: @ZeusFa So fitInView doesn't change the size of the scene? I certainly hope not! It's a view onto the scene, it should not change anything on the scene. If you take a photo of a cat, and the cat is too small to see, to make it fill the view you don't change the size of the cat, you zoom the view instead :) How can I get the scale value after fitInView? Irritatingly QGraphicsView offers scale() to change the view's scale but not a method to return just the current scale. IIRC you have to call transform() to get the whole current QTransform and access the individual transformation members (m11() and m22(), I think) if you want retrieve the current scale. Try printing these out before and after fitInView() and I think you will see those change. (You may also see the origin/translation change if fitting in view alters the view's top-left corner position on the scene. The others should not change.) Got it, thank you!
  • QTextBlockFormat resets by pressing the return key for empty block

    Solved
    3
    0 Votes
    3 Posts
    303 Views
    K
    @SGaist thanks, I tried to find something but no luck. However, I managed to find a workaround. I installed an event filter for the text widget that is listening for the return key and manually inserts a new block. If someone is interested in the code: if (event->type() == QEvent::KeyPress && object == ui->textEdit) { QKeyEvent* key = static_cast<QKeyEvent*>(event); if (key->key() == Qt::Key_Return) { QTextCursor cursor = ui->textEdit->textCursor(); cursor.insertBlock(); ui->textEdit->setTextCursor(cursor); return true; } return false; }
  • QComboBox bug in Qt5.15

    Unsolved
    25
    0 Votes
    25 Posts
    4k Views
    K
    Ok - this seems to actually be a bug in Qt introduced in Qt 5.15.3 - however it is resolved some time between Qt 6.0.0 and 6.5.1. I retested with Qt 6.5.1, and it seems not to reproduce there. The bug shows up in Qt 5.15.3, but not in Qt 5.15.2 and not in Qt 6.5.1. Given this, it isn't worth making a bug report about it, since it is already fixed in Qt 6. If anyone reading this is interested to test, I have updated my bug exploration repo with this new info: https://github.com/keithel/qapitrace-combobox-elide-bug
  • QTcpSocket Read/Write correctly & reliable

    Unsolved qtcpsocket qdatastream readyread qiodevice qtcpserver
    8
    0 Votes
    8 Posts
    2k Views
    JonBJ
    @Narutoblaze Your code/algorithm is incorrect. This is basic coding, please study what your code does. You "actively" encourage reading across file boundaries, i.e. what you call "too much"). You (seem to) start by setting size to the total number of bytes expected for the file. Then you call read(buffer, size);. But when that returns with fewer bytes than size you still call it again next time round asking it to read up to size further bytes. This can/will exceed the number of bytes in the first file. You obviously need to reduce what size you pass to read() accordingly on subsequent calls. And then be careful what you compare in your if (... || numReadTotal == size). Adjust your code however to make it right. I previously said that the whole synchronous approach of repeatedly calling waitForReadyRead() in a loop is not the event-driven way to do things. Allow bytes to arrive in repeated readyRead() signals asynchronously instead.
  • QJSEngine does not support JavaScript lambdas as expected

    Unsolved javascript qjsengine qjsvalue callback
    1
    0 Votes
    1 Posts
    386 Views
    No one has replied
  • How to propagate the wheelEvent to multiple widgets of my centralwidget

    Unsolved
    11
    0 Votes
    11 Posts
    1k Views
    T
    @JonB In the code I provide in my previous message, the MyWidget seems to execute the code assiocated to the wheelevent, and then the event is propagated to the parent widget (the central widget is this case). And the central widget re-propagate the event to all its children (including the original widget). How to avoid this first process, the one before sending the event to the parent ?
  • My QFrame widget is not well center-aligned

    Unsolved
    2
    0 Votes
    2 Posts
    255 Views
    Axel SpoerlA
    @1XU7 The label's text is left-aligned by default. This line will fix the issue: lblTitle->setAlignment(Qt::AlignCenter);
  • erueur when use Qxlnt libray

    Unsolved
    11
    0 Votes
    11 Posts
    660 Views
    S
    I have use xlnt (which Qxlnt is based on) before. What I found is that when you enter an equation and then pull it over several cells xlnt is not able to open that file anymore. There is a fix which hasn't been released yet (last time I checked) which will not crash when you try to open the file, but will corrupt it if you write back to it. So, unless every cell has been entered individually (or imported), don't use Qxlnt/xlnt to work with Excel files. Or help improve the library.
  • Static library don't see image paths

    Solved
    10
    0 Votes
    10 Posts
    734 Views
    S
    @AndrzejB said in Static library don't see image paths: original icon scaled 100% in Gimp Again, do you use display scaling? Gimp might adjust what "100%" means based on display scaling.
  • QGLFormat class

    Solved
    3
    0 Votes
    3 Posts
    202 Views
    D
    @Christian-Ehrlicher Thank you christian. Yes. Now i included and found it works. its my mistake. thank you again. Regards, dan
  • Dialog closed automatically when swip/scroll insde Dialog Window.

    Unsolved
    3
    0 Votes
    3 Posts
    217 Views
    B
    @Pl45m4 Yes. Even our initial assumption was same. However we confirmed this by getting touch coordinates from touch driver. With our test we found that our touch coordinates are within the boundary of the dialog window.
  • Can't locate devices with QtBluetooth low energy

    Solved
    3
    0 Votes
    3 Posts
    329 Views
    S
    Hi @JonB, so I've tried the 40 second timeout, but the scan seems to finish after 13 seconds, no matter the timeout. Even if I put -1, 200, 1000 or 40000, it's always 13 seconds. My compiler is MinGW, but after changing it to MSVC (had to install visual basic build tools to get a working compiler), it works now! All the bluetooth devices I need have been found and the timeout works too. Thank you! Edit: My Qt version is 5.15.2
  • Stdin doesn't read

    Unsolved
    4
    0 Votes
    4 Posts
    391 Views
    Pl45m4P
    @s_milena__97 If you dont use any Qt GUI elements yet, you can add CONFIG += console to your zdravosvetee.pro file, go to your projects "Build and run" settings and check "Run in terminal" there.
  • Qt5.15.0 with Visual Studio 2017 - where is msvc2017_64

    Unsolved
    4
    0 Votes
    4 Posts
    4k Views
    Christian EhrlicherC
    @Go-Fish said in Qt5.15.0 with Visual Studio 2017 - where is msvc2017_64: They are not. There is no such thing as binary compatibility "with MSVS". Microsoft platform doesn't operate by that principle. They use Side-by-side installation meaning if you compiled a binary with another version of SxS library (identified by embedded hash), you have to provide distribution for them. Nice that someone registered here just to spread fud / showing that he doesn't know what binary compatibility means: https://learn.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=msvc-170
  • QMessageBox non blocking

    Unsolved
    12
    0 Votes
    12 Posts
    6k Views
    I
    Try using QApplication::processEvents() after show() and before the work starts. This solved the issue for me.
  • How to use additional syntax files?

    Solved
    1
    0 Votes
    1 Posts
    132 Views
    No one has replied
  • KsyntaxHighlighting::Definition and rules for tokens

    Unsolved kde
    2
    0 Votes
    2 Posts
    453 Views
    SGaistS
    Hi, rehighlightBlock belongs to QSyntaxHighlighter. Use the original repos, the clones are usually for people to do development before creating a merge request.
  • QListWidget expand to the height of the widgets inside like layout

    Locked Unsolved
    2
    0 Votes
    2 Posts
    391 Views
    SGaistS
    Hi, Please don't post the same question in multiple sub forum, one is enough. Duplicate Closing this one