qt5

How to move the whole window when mouse is on the window's custom widget in Qt?

眉间皱痕 提交于 2020-08-26 10:02:30
问题 Let's say I have a custom widget and add it to the main window in qt. As you can see, the red area is the custom widget. What I want to do is when the mouse is pressed in the red area and moved, the whole window will move as well. I know how to simply implement mousePressEvent and mouseMoveEvent ; but when dealing with a window with the custom widget, I do not know how to move the whole window when mouse is pressed on the custom widget. Also I want to mention that I only want the window

Can a QComboBox display a different value than whats in it's list?

限于喜欢 提交于 2020-08-25 07:27:11
问题 Using Qt 5.9 on Linux, I have a QComboBox with several labels. qc = new QComboBox; qc->addItem(tr("Red")); qc->addItem(tr("Green")); qc->addItem(tr("Blue")); Lets say a user activates the QComboBox and the 3 color labels are shown in the drop down list. The user then selects the 1st item (red). What I want to do is have the QComboBox display a different value than what was selected. I.e., if red is selected, then a number is shown, possibly 1 for the first item (or it could be an R for Red),

Can a QComboBox display a different value than whats in it's list?

淺唱寂寞╮ 提交于 2020-08-25 07:27:09
问题 Using Qt 5.9 on Linux, I have a QComboBox with several labels. qc = new QComboBox; qc->addItem(tr("Red")); qc->addItem(tr("Green")); qc->addItem(tr("Blue")); Lets say a user activates the QComboBox and the 3 color labels are shown in the drop down list. The user then selects the 1st item (red). What I want to do is have the QComboBox display a different value than what was selected. I.e., if red is selected, then a number is shown, possibly 1 for the first item (or it could be an R for Red),

QMovie webp frame stutters

你。 提交于 2020-08-09 09:46:08
问题 I'm using QMovie to play a webp animation on a QLabal, the code like: Foo::Foo() { movie_ = new QMovie("/path/to/my.webp", "", this); ui->label->setMovie(movie_); } void Foo::on_pushButton_clicked() { movie_->stop(); movie_->start(); } But when I play the animation, the frame stutters, like: I try to extract the webp frames by using QImage::save, the code like: QImageReader *reader = new QImageReader("/path/to/my.webp"); reader->setDecideFormatFromContent(true); for (int i = 0; i < reader-

QMovie webp frame stutters

自闭症网瘾萝莉.ら 提交于 2020-08-09 09:45:26
问题 I'm using QMovie to play a webp animation on a QLabal, the code like: Foo::Foo() { movie_ = new QMovie("/path/to/my.webp", "", this); ui->label->setMovie(movie_); } void Foo::on_pushButton_clicked() { movie_->stop(); movie_->start(); } But when I play the animation, the frame stutters, like: I try to extract the webp frames by using QImage::save, the code like: QImageReader *reader = new QImageReader("/path/to/my.webp"); reader->setDecideFormatFromContent(true); for (int i = 0; i < reader-