Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • Adding a QTreeWidget item border

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    L
    @SGaist Thank you for your help. I was able to achieve the desired effect by adding the following: QTreeView::branch{ border-bottom: 1px solid rgb(210, 210, 210); } However, annoyingly, this will remove the arrows from the tree. These can be added via: QTreeView::branch:closed:has-children { border-image: none; image: url(C:/Users/Carlos/Desktop/branch-closed.png); } QTreeView::branch:open:has-children { border-image: none; image: url(C:/Users/Carlos/Desktop/branch-open.png); } However, ideally I wouldn't need to rely on these extra *.png files. Is there a way to include the original arrows? [image: 57e75bb7-52ba-4257-b465-9e0d5e6c1b66.png]
  • QGraphicsView resize issue

    Unsolved qgraphicsview qgraphicsscene qpixmap
    7
    0 Votes
    7 Posts
    2k Views
    SGaistS
    Animation, composition, overlaying and whatever comes to your imagination. That said, if you are really only showing one single image and nothing more then, indeed, a QLabel is enough.
  • Fix QThread

    Unsolved
    12
    0 Votes
    12 Posts
    751 Views
    SGaistS
    I don't see a reason for a single shot connection. Implement proper clearing of the label, configuration of your detector, etc. You really should write down the various workflows of your application.
  • need to modify layout fill policy

    Solved
    12
    0 Votes
    12 Posts
    719 Views
    JonBJ
    @Kent-Dorfman This question does get asked many times. ISTM that layouts should offer the functionality without user having to put a space/stretch at the other end of the layout to achieve this. I should be able to say "align/place all things from left/right/top/bottom one after the other, do not expand/move them", it's pretty common to want this....
  • QMessageBox::warning replacement that wont process the event loop

    Unsolved
    40
    0 Votes
    40 Posts
    11k Views
    S
    @hskoglund I already tried something like that.
  • HTTP library

    Unsolved
    29
    0 Votes
    29 Posts
    3k Views
    jsulmJ
    @jenya7 Yes, clean rebuild often does wonders just like Windows reboot :-)
  • QT Project run fine on Dev pc but not on deployment PC

    Unsolved
    7
    0 Votes
    7 Posts
    428 Views
    V
    @JoeCFD Hey, so I've added where all the libraries are to the environment vars as well as dragged and dropped them where the .exe exists.
  • This topic is deleted!

    Unsolved
    8
    0 Votes
    8 Posts
    31 Views
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    12 Views
    No one has replied
  • Qt5 C++ application compilation from prompt

    Unsolved
    27
    0 Votes
    27 Posts
    4k Views
    R
    @ChrisW67 Thanks for help. Program compiles without problem.
  • Swift in Qt. Is there any manual or how-to?

    Solved
    8
    0 Votes
    8 Posts
    3k Views
    B
    The solution for using Swift found. Here the published example when you using CMake subdirectories and here The problem when you using it's like subtarget not solved yet. The Swift code pieces must be in main target. If it's not, you will have this kind of troubles. If anyone wants to solve troubles with implementing Swift in subtargets you can play with this project For me all is working pretty good like it's described above. For me issue totally closed. Happy coding!
  • Change of behavior with the scrollbar with QGraphicsScene in Windows 11

    Unsolved
    3
    0 Votes
    3 Posts
    311 Views
    A
    @Onur-Tekik Are you using a version of Qt which supports Windows 11?
  • This topic is deleted!

    Solved
    3
    0 Votes
    3 Posts
    78 Views
  • QTableView style looks like Excel table

    Unsolved
    2
    0 Votes
    2 Posts
    373 Views
    A
    @Alexey-Serebryakov UP
  • Blackberry QNX, how to start what QT version to choose

    Unsolved
    2
    0 Votes
    2 Posts
    161 Views
    jsulmJ
    @kapabahwuk said in Blackberry QNX, how to start what QT version to choose: has icon for Blackberry What icon do you mean and where? Did you read https://doc.qt.io/qt-5/qnx.html ?
  • Segmentation Fault : How to debug on target hw

    Unsolved
    2
    0 Votes
    2 Posts
    331 Views
    jsulmJ
    @Parvathy2020 Usual way to analyse such issues is to check core dumps generated on the target device after the crash. You can also do remote debugging if you can get GDB server to run on your device (you did not mention what device that is and what OS is running there). Even easier is it if you can install GDB and then debug directly on the device.
  • How to animate a widget like discord 'zoom animation'

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    M
    @jsulm said in How to animate a widget like discord 'zoom animation': @Marcia3x In the link @jeremy_k gave you there is an example: QPushButton button("Animated Button"); button.show(); QPropertyAnimation animation(&button, "geometry"); animation.setDuration(10000); animation.setStartValue(QRect(0, 0, 100, 30)); animation.setEndValue(QRect(250, 250, 100, 30)); animation.start(); Just do not change x/y, only change width/height. After a lot of search and effort, I did something: // stackedwidget.h class StackedWidget : public QStackedWidget { Q_OBJECT public: enum QEasingCurve::Type m_animationtype = QEasingCurve::Type::OutQuart; int m_speed = 1000; int m_now; int m_next; bool animation_active = false; QPoint m_pnow; QParallelAnimationGroup* animgroup; StackedWidget(QWidget* parent) : QStackedWidget(parent) { QWidget* widget = new QWidget(); QGridLayout* widget_layout = new QGridLayout(); widget->setLayout(widget_layout); QPushButton* button; for (size_t i = 0; i < 10; i++) { button = new QPushButton(); button->setText("Button " + QString::number(i)); button->setStyleSheet(R"( background-color: #3c3f45; border-radius: 4px; color: rgba(255, 255, 255, 0.4); font-size: 15px; font-weight: 600; )"); widget_layout->addWidget(button); } button->setText("Change Page"); connect(button, &QPushButton::clicked, [=] { animimateToPage(1); }); QWidget* widget_2 = new QWidget(); QGridLayout* widget_layout_2 = new QGridLayout(); widget_2->setLayout(widget_layout_2); for (size_t i = 0; i < 10; i++) { button = new QPushButton(); button->setText("================ " + QString::number(i)); button->setStyleSheet(R"( background-color: #3c3f45; border-radius: 4px; color: rgba(255, 255, 255, 0.4); font-size: 15px; font-weight: 600; )"); widget_layout_2->addWidget(button); } button->setText("return"); connect(button, &QPushButton::clicked, [this] { animimateToPage(0); }); addWidget(widget); addWidget(widget_2); } void animimateToPage(int index) { if (animation_active) return; animation_active = true; int now = currentIndex(); int next = indexOf(widget(index)); int offsetx = frameRect().width(); int offsety = frameRect().height(); widget(next)->setGeometry(0, 0, offsetx, offsety); QPoint pnext = widget(next)->pos(); QPoint pnow = widget(now)->pos(); m_pnow = pnow; //widget(next)->move(pnext.x() - offsetx, pnext.y() - offsety); QRect rnext = widget(next)->geometry(); QRect rnow = widget(now)->geometry(); int addw = 300; int addh = 100; widget(next)->show(); widget(next)->raise(); QPropertyAnimation* animnow = new QPropertyAnimation(widget(now), "geometry"); animnow->setDuration(m_speed); animnow->setEasingCurve(m_animationtype); animnow->setStartValue(QRect(0, 0, rnow.width(), rnow.height())); animnow->setEndValue(QRect(0, 0, rnow.width() - addw, rnow.height() - addh)); QGraphicsOpacityEffect* animnow_op_eff = new QGraphicsOpacityEffect(); widget(now)->setGraphicsEffect(animnow_op_eff); QPropertyAnimation* animnow_op = new QPropertyAnimation(animnow_op_eff, "opacity"); animnow_op->setDuration(m_speed); animnow_op->setStartValue(1); animnow_op->setEndValue(0); QPropertyAnimation* animnext = new QPropertyAnimation(widget(next), "geometry"); animnext->setDuration(m_speed); animnext->setEasingCurve(m_animationtype); animnext->setStartValue(QRect(0, 0, rnext.width() - addw, rnext.height() - addh)); animnext->setEndValue(QRect(0, 0, rnext.width(), rnext.height())); QGraphicsOpacityEffect* animnext_op_eff = new QGraphicsOpacityEffect(); animnext_op_eff->setOpacity(0); widget(next)->setGraphicsEffect(animnext_op_eff); QPropertyAnimation* animnext_op = new QPropertyAnimation(animnext_op_eff, "opacity"); animnext_op->setDuration(m_speed); animnext_op->setStartValue(0); animnext_op->setEndValue(1); animgroup = new QParallelAnimationGroup; animgroup->addAnimation(animnow); animgroup->addAnimation(animnext); animgroup->addAnimation(animnow_op); animgroup->addAnimation(animnext_op); QObject::connect(animgroup, &QParallelAnimationGroup::finished, this, &StackedWidget::animationDoneSlot); m_next = next; m_now = now; animgroup->start(QAbstractAnimation::DeleteWhenStopped); } void animationDoneSlot() { setCurrentIndex(m_next); widget(m_now)->hide(); widget(m_now)->move(m_pnow); widget(m_now)->setGraphicsEffect(nullptr); widget(m_next)->setGraphicsEffect(nullptr); animation_active = false; } }; #include "stackedwidget.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); ui.centralWidget->setStyleSheet("#centralWidget { background-color: #36393f; }"); QGridLayout* layout = new QGridLayout(); ui.centralWidget->setLayout(layout); StackedWidget* stacked_widget = new StackedWidget(this); layout->addWidget(stacked_widget); return; } I have added some random buttons which colors similar to those seen in discord just to help check if the animation is 'correct'. Result: [image: 27446870-a261-4748-879c-3d04afeb34b8.gif] Looks like there's any kind of flickering in the animation, and I'm struggling with how to calculate the values to use in start/end of the geometry animation. The animation I'm referring to: https://i.imgur.com/fC2cTCY.gif (i reduced the speed of the animation, also, click on the image to enlarge it) https://imgur.com/a/nUuOGSn (default speed)
  • Issues with Publishing using Mosquitto Library

    Solved
    4
    0 Votes
    4 Posts
    557 Views
    C
    When you were testing with the command line tool you were on the server machine and the certificate therefore matched?
  • There is a ghost widget!!!!!!

    Unsolved widget qmediaplayer qvideowidget
    4
    0 Votes
    4 Posts
    991 Views
    S
    @Christian-Ehrlicher in the same strange way, i have an void : void QtVsPlayer::FullScr() { if (QtVsPlayer::isFullScreen()) { QtVsPlayer::showNormal(); this->ui->menubar->setVisible(true); if (!Zoomed) this->ui->statusbar->setVisible(true); } else { QtVsPlayer::showFullScreen(); this->ui->menubar->setVisible(false); this->ui->statusbar->setVisible(false); } return; } this void work, i have fullscreen video. now in mousemove event i have if (!this->ui->actionMasquer_les_controles->isChecked() and WVideoCtrls->isHidden() and this->ui->actionAuto_hide_controls->isChecked()) { if(!Zoomed and QtVsPlayer::isFullScreen() == false) ui->statusbar->setVisible(true); WVideoCtrls->show(); WVideoCtrls->activateWindow(); WVideoCtrls->raise(); this->centralWidget()->lower(); this->centralWidget()->stackUnder(WVideoCtrls); } if (QtVsPlayer::cursor() == Qt::BlankCursor) { QtVsPlayer::unsetCursor(); } return; the goal is to display videocontrols, like play, pause and so on, but not the status bar in full screen, but it is shown, zoomed is false but isfullscreen is no such value
  • When i should/shouldnt i use QGraphicsView ?

    Unsolved
    5
    0 Votes
    5 Posts
    821 Views
    kkoehneK
    @Marcia3x said in When i should/shouldnt i use QGraphicsView ?: I don't understand what QGraphicsView is used for, and this is what I'm currently asking... QGraphicsView is a framework for rendering 2d content that predates Qt Quick. Back then, everything was a Qt Widget, but writing custom widgets is actually not easy & rather heavy if you're talking about lots of items. Qt Graphics View Framework does allow for drawing a scene lightweight items that do scale well. So in a way it's a predecessor of Qt Quick (though there are also lots of differences, and there are still valid use cases where you want to use QGraphicsView, and not Qt Quick). Note that 'View' is just a general term here. That GraphicsView and WebEngineView both use it doesn't mean that they are technically interconnected. If is possible to render the QWebEngineView and other widgets in the QGraphicsView, and if doing such a thing could improve performance. You might actually be able to do this, since GraphicsView does allow for embedding a widget inside the view... But there's no reason to believe this will be faster. On the contrary, it is another level of indirection. When I resize the scroll area the web engine is moved weirdly, looks like it only gets 'repositioned' in the grid, after all widgets have finished being repositioned. I think this is explained by WebEngineView being a rather heavy component, that also does rendering out of process. This is btw not only an issue with Qt ... check any contemporary browser, and resizing the main window isn't exactly smooth, at least for me.