How do i resize the contents of a QScrollArea as more widgets are placed inside

If you’re coming here from Google and not having luck with the accepted answer, that’s because you’re missing the other secret invocation: QScrollArea::setWidget. You must create and explicitly identify a single widget which is to be scrolled. It’s not enough to just add the item as a child! Adding multiple items directly to the ScrollArea … Read more

Determine signals connected to a given slot in Qt

I think Qt stores the slots a given signal is connected to, so that when you emit it all receivers are called, therefore you can access the list of receivers: For debugging purposes, you have: void QObject::dumpObjectInfo () Dumps information about signal connections, etc. for this object to the debug output. This function is useful … Read more

Different delegates for QML ListView

I’ve had the same problem, the Qt documentation is providing a pretty good answer: http://doc.qt.io/qt-5/qml-qtquick-loader.html#using-a-loader-within-a-view-delegate The easiest solution is an inline Component with a Loader to set a source file: ListView { id: contactsView anchors.left: parent.left anchors.top: parent.top width: parent.width height: parent.height orientation: Qt.Vertical spacing: 10 model: contactsModel delegate: Component { Loader { source: switch(position) … Read more

What is the most efficient way to display decoded video frames in Qt?

Thanks for the answers, but I finally revisited this problem and came up with a rather simple solution that gives good performance. It involves deriving from QGLWidget and overriding the paintEvent() function. Inside the paintEvent() function, you can call QPainter::drawImage(…) and it will perform the scaling to a specified rectangle for you using hardware if … Read more

QListView/QListWidget with custom items and custom item widgets

I think you need to subclass QItemDelegate. QItemDelegate can be used to provide custom display features and editor widgets for item views based on QAbstractItemView subclasses. Using a delegate for this purpose allows the display and editing mechanisms to be customized and developed independently from the model and view. This code is taken from Qt’s … Read more

How to fix the error “QObject::moveToThread:” in opencv in python?

I got same problem, it was from opencv-python version problem for me. My Linux machine’s environment is as following: $ cat /etc/lsb-release … DISTRIB_DESCRIPTION=”Ubuntu 18.04.5 LTS” $ date Tue Aug 11 11:43:16 KST 2020 $ python –version Python 3.7.8 $ pip list|grep Qt PyQt5 5.15.0 PyQt5-sip 12.8.0 $ pip list|grep opencv-python opencv-python 4.3.0.38 I downgraded … Read more

Changing DPI scaling size of display make Qt application’s font size get rendered bigger

High DPI support is enabled from Qt 5.6 onward. Setting QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling) in your application source code allows automatic high-DPI scaling. NOTICE: To use the attribute method, you must set the attribute before you create your QApplication object: #include <QApplication> int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); return app.exec(); }

Display QImage with QtGui

Simple, but complete example showing how to display QImage might look like this: #include <QtGui/QApplication> #include <QLabel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QImage myImage; myImage.load(“test.png”); QLabel myLabel; myLabel.setPixmap(QPixmap::fromImage(myImage)); myLabel.show(); return a.exec(); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)