Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 458.1k Posts
  • How to manage signals in QThread

    Unsolved
    19
    0 Votes
    19 Posts
    2k Views
    Christian EhrlicherC
    @masa4 said in How to manage signals in QThread: But other way how can i continuously get the values of variables? For the third time (or even more): Use a QTimer!
  • QWizard stylesheet

    Unsolved
    1
    0 Votes
    1 Posts
    250 Views
    No one has replied
  • Installing MQTT module

    Unsolved mqtt c++ widget ubuntu
    11
    0 Votes
    11 Posts
    6k Views
    jsulmJ
    @Dean21 @JoeCFD asked where the mqtt libs you built are stored, not where the code is...
  • 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
    776 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
    751 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
    448 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
    317 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
    386 Views
    A
    @Alexey-Serebryakov UP
  • Blackberry QNX, how to start what QT version to choose

    Unsolved
    2
    0 Votes
    2 Posts
    166 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
    338 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)