Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Migration Qdropevent from qt4 to qt5

    Unsolved
    4
    0 Votes
    4 Posts
    354 Views
    SGaistS
    You're welcome ! Since you have your answer, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)
  • Drawing a vertical line on a QPlainTextEdit?

    Solved
    2
    0 Votes
    2 Posts
    870 Views
    mrjjM
    Hi Sure it is. Fast sample. Note. using fixed numbers. you want to use viewport()->height() etc. #ifndef MYTEXT_H #define MYTEXT_H #include <QPainter> #include <QPlainTextEdit> class MyText : public QPlainTextEdit { Q_OBJECT public: explicit MyText(QWidget *parent = nullptr) : QPlainTextEdit(parent) {} protected: virtual void paintEvent(QPaintEvent *event) override { QPlainTextEdit::paintEvent(event); QPainter p(viewport()); // note we use viewport as its the one that actually draws p.drawLine(100, 0, 100, 1000); } }; #endif // MYTEXT_H [image: 4EsvmF.png]
  • SEGFAULT after Qt update

    Unsolved
    4
    0 Votes
    4 Posts
    824 Views
    aha_1980A
    @BRULE-Herman you should vote and comment on the bugreport. Probably some has a workaround. Also note, that a proposed fix is linked there, in case you compile Qt from source.
  • Whats the best way to access objects out of a QList<Object> from QML

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    M
    @fcarney said in Whats the best way to access objects out of a QList<Object> from QML: Heh, I found this: qml/c++ integration Wow nice find... I looked at the qmlRegisterType... I have been getting away with just regular qRegisterMetaType. For my application I don't want any objects created in QML just want to reference them from C++. I will look into this find more and hopefully it will help OP too. xD
  • SQLite databases queries issues

    Unsolved
    6
    0 Votes
    6 Posts
    828 Views
    VRoninV
    In addition to what @SGaist said, you should not keep QSqlDatabase variables around. they should be local scoped. see the docs for the official warning. Coming to your problem, why don't you just change the query to "select Name, Age from employeeinfo" and then use ui->lineEdit->setText(ui->comboBox->model()->index(ui->comboBox->currentIndex(),1).data().tostring()); to retrieve the age? no need to execute the query twice
  • where compiler and kit info is saved

    Unsolved
    12
    0 Votes
    12 Posts
    2k Views
    R
    thanks @jsulm and @J-Hilk I really appreciate your help. After spending 4 sleepless nights on this, I now got my answer.
  • how to create Singleinstance application

    Solved
    13
    0 Votes
    13 Posts
    4k Views
    B
    @jsulm said in how to create Singleinstance application: QMessageBox::information(nullptr, "Information", "Already running!", ...); thank you so much its worked....
  • "could not find or load the Qt platform plugin "windows" in "",

    Unsolved
    3
    0 Votes
    3 Posts
    435 Views
    tomyT
    @VRonin Apparently it's used to create a folder containing the installable program. But I have produced the installable file using Qt Installer Framework previously. And it could be installed on Windows and run well. Recently I added some new paths to the Path and changed it that way, for example for Gradle and now after installing the program and when double clicking on its icon, I get the error. Do you still think the windeployqt.exe tool can be helpful?
  • Access variables between multiple classes/objects

    Unsolved
    4
    0 Votes
    4 Posts
    857 Views
    J.HilkJ
    @AaronKelsey techenically it can be done with inheritance, but that would also requiere singletons and stuff, urgh let's not go there. The cleanest way I can see for this special case, is make a class/struct that holds all the data you want to "share" make the variables accessable via getters and setters, if your class is derived from QObject, you could emit a "changed"signal to update the other classes. Than in the top most parent class create that class + all of the other 4 and pass a reference around and store the pointer in a member variable
  • how give smooth transmision to avatar image

    Solved
    4
    0 Votes
    4 Posts
    580 Views
    B
    thanks for your reply problem is sloved QPixmap pix; pix.loadFromData(image_data); int size = qMax(pix.width(), pix.height()); QPixmap rounded = QPixmap(size, size); rounded.fill(Qt::transparent); QPainterPath path; path.addEllipse(rounded.rect()); QPainter painter(&rounded); painter.setClipPath(path); painter.fillRect(rounded.rect(), Qt::black); int x = qAbs(pix.width() - size) / 2; int y = qAbs(pix.height() - size) / 2; painter.drawPixmap(x, y, pix.width(), pix.height(), pix); ui->pushButton_4->setIcon(QIcon(rounded));
  • How can change the color of the button when the page background-image is changed?

    Solved
    2
    0 Votes
    2 Posts
    298 Views
    mrjjM
    Hi StyleSheet are cascading so it will affect all children also, unless you use names or other selectors to specify which widgets you mean. http://doc.qt.io/qt-5/stylesheet-examples.html#style-sheet-usage Read the section about selectors
  • Windows Development on Mac

    Unsolved
    4
    0 Votes
    4 Posts
    490 Views
    jsulmJ
    @Kycho said in Windows Development on Mac: I have experience compiling Linux devices through SSH I guess you mean "compiling ON Linux devices through SSH"? For Windows you need a Windows machine to compile. Either install Windows in a virtual machine or use a real machine with Windows which you can access remotely if needed.
  • const wchar_t* and QString Problem

    Unsolved
    3
    0 Votes
    3 Posts
    547 Views
    aha_1980A
    @pixbyte In addition to what mpergand suggested, if you only need a read-only access to the path (like const wchar_t * suggests), you can use QString::utf16() and a cast to wchar_t and therefore avoid the additional allocation and copy. Please note, that this is a Windows-only thing, as wchar_t can be 4 byte on Unix. Regards
  • Why Do You Import The mainwindow.h In main.cpp?

    Solved
    12
    0 Votes
    12 Posts
    2k Views
    M
    @JKSH That solved my question, thank you!
  • Crash on QNX environment

    Unsolved
    12
    0 Votes
    12 Posts
    6k Views
    jsulmJ
    @Yaswanth Please run your app through debugger until it crashes and post the stack trace, else we will discuss this forever.
  • QTextCharFormat tooltip

    Unsolved
    4
    0 Votes
    4 Posts
    656 Views
    SGaistS
    What is the exact version of PyQt 5 that you are using ? Also, how did you installed it ?
  • Parse the arguments given by user in QLineEdit and place them in QVector<QString>

    Unsolved
    3
    0 Votes
    3 Posts
    565 Views
    SGaistS
    Hi, To add to @dheerendra, what are you going to use these arguments for ?
  • Cannot see values of variables when debugging

    Solved
    3
    0 Votes
    3 Posts
    4k Views
    SGaistS
    Hi, It's indeed surprising... Anyway, thanks for sharing ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)
  • SQL Driver Loading Problems

    Unsolved
    2
    0 Votes
    2 Posts
    331 Views
    SGaistS
    Hi, Start your application with the QT_DEBUG_PLUGINS environment variable set to 1. It will give you a log of what is happening on the start of your application.
  • Loading a dylib function using QLibrary

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    SGaistS
    That's up to you. Personally, since you have a SDK at your disposal, I don't see why you wouldn't link to the libraries directly.