跳到內容
  • 版面
  • 最新
  • 標籤
  • 熱門
  • 使用者
  • 群組
  • 搜尋
  • Get Qt Extensions
  • Unsolved
Collapse
品牌標誌
  1. 首頁
  2. Qt Development
  3. General and Desktop
  4. QWidget top level widget
Forum Updated to NodeBB v4.3 + New Features

QWidget top level widget

已排程 已置頂 已鎖定 已移動 Unsolved General and Desktop
21 貼文 5 Posters 2.8k 瀏覽 3 Watching
  • 從舊到新
  • 從新到舊
  • 最多點贊
回覆
  • 在新貼文中回覆
登入後回覆
此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
  • mrjjM mrjj

    @Alexey-Serebryakov
    Ohh.
    Like Win 10 Toast messages?

    But you must run on other platforms and prefer your own ?

    https://doc.qt.io/qt-5/qtwidgets-desktop-systray-example.html

    also for full blown usage
    https://github.com/mohabouje/WinToast

    A 離線
    A 離線
    Alexey Serebryakov
    寫於 最後由 編輯
    #12

    @mrjj yes, like Win 10 Toast.
    Application run on Windows 10 and Ubuntu. So I need show custom popup widget. :-(
    Thank you but built-in systray not allowed.

    mrjjM 1 條回覆 最後回覆
    0
    • A Alexey Serebryakov

      @mrjj yes, like Win 10 Toast.
      Application run on Windows 10 and Ubuntu. So I need show custom popup widget. :-(
      Thank you but built-in systray not allowed.

      mrjjM 離線
      mrjjM 離線
      mrjj
      Lifetime Qt Champion
      寫於 最後由 編輯
      #13

      @Alexey-Serebryakov

      Ok, it must be totally custom.
      QSystray also had issues on ubuntu over the years.

      So is the message also clickable like Toats are or is it more like a tooltip type ?

      A 1 條回覆 最後回覆
      0
      • mrjjM mrjj

        @Alexey-Serebryakov

        Ok, it must be totally custom.
        QSystray also had issues on ubuntu over the years.

        So is the message also clickable like Toats are or is it more like a tooltip type ?

        A 離線
        A 離線
        Alexey Serebryakov
        寫於 最後由 Alexey Serebryakov 編輯
        #14

        @mrjj Yes there popup widget has title, text, image, close button, links and so on. User can click them and follow to the main window by context dependency. Also popup widget can contain other user-defined custom widget.

        mrjjM 1 條回覆 最後回覆
        0
        • A Alexey Serebryakov

          @mrjj Yes there popup widget has title, text, image, close button, links and so on. User can click them and follow to the main window by context dependency. Also popup widget can contain other user-defined custom widget.

          mrjjM 離線
          mrjjM 離線
          mrjj
          Lifetime Qt Champion
          寫於 最後由 編輯
          #15

          @Alexey-Serebryakov

          Oh so its a FancyToast widget ;)

          Well it should not be that hard to place it. and the rich part sounds lovely.

          Do notice on some virtual Desktops, its like one big screen and you will have to move your window
          to right x pos as there will be only 1 screen.

          A 2 條回覆 最後回覆
          0
          • mrjjM mrjj

            @Alexey-Serebryakov

            Oh so its a FancyToast widget ;)

            Well it should not be that hard to place it. and the rich part sounds lovely.

            Do notice on some virtual Desktops, its like one big screen and you will have to move your window
            to right x pos as there will be only 1 screen.

            A 離線
            A 離線
            Alexey Serebryakov
            寫於 最後由 Alexey Serebryakov 編輯
            #16

            @mrjj what the FancyToast?

            1 條回覆 最後回覆
            0
            • mrjjM mrjj

              @Alexey-Serebryakov

              Oh so its a FancyToast widget ;)

              Well it should not be that hard to place it. and the rich part sounds lovely.

              Do notice on some virtual Desktops, its like one big screen and you will have to move your window
              to right x pos as there will be only 1 screen.

              A 離線
              A 離線
              Alexey Serebryakov
              寫於 最後由 編輯
              #17

              @mrjj yeah virtual desktop is next my head ache... :-)

              1 條回覆 最後回覆
              0
              • Axel SpoerlA 離線
                Axel SpoerlA 離線
                Axel Spoerl
                Moderators
                寫於 最後由 編輯
                #18

                Instantiating a QWidget and calling show()create a series of events that get processed asynchronously. It cannot be safely assumed that windowHandle()returns a valid pointer right after construction and/or calling show(). You might be more lucky on Win10, than on UBuntu/X11.

                If you want to wait for the widget to be fully constructed, you have to wait for windowHandle() != nullptr, e.g. by

                while (!w1.windowHandle())
                    a.processEvents();
                

                QWindow::isExposed()tells if the window has been rendered on a screen.

                Software Engineer
                The Qt Company, Oslo

                A 1 條回覆 最後回覆
                2
                • Axel SpoerlA Axel Spoerl

                  Instantiating a QWidget and calling show()create a series of events that get processed asynchronously. It cannot be safely assumed that windowHandle()returns a valid pointer right after construction and/or calling show(). You might be more lucky on Win10, than on UBuntu/X11.

                  If you want to wait for the widget to be fully constructed, you have to wait for windowHandle() != nullptr, e.g. by

                  while (!w1.windowHandle())
                      a.processEvents();
                  

                  QWindow::isExposed()tells if the window has been rendered on a screen.

                  A 離線
                  A 離線
                  Alexey Serebryakov
                  寫於 最後由 編輯
                  #19

                  @Axel-Spoerl thank you,
                  consider example code above,
                  how can I show w1 widget on first monitor and w2 on second?
                  Now both widgets showing on the same primary monitor.

                  Axel SpoerlA 1 條回覆 最後回覆
                  0
                  • A Alexey Serebryakov

                    @Axel-Spoerl thank you,
                    consider example code above,
                    how can I show w1 widget on first monitor and w2 on second?
                    Now both widgets showing on the same primary monitor.

                    Axel SpoerlA 離線
                    Axel SpoerlA 離線
                    Axel Spoerl
                    Moderators
                    寫於 最後由 Axel Spoerl 編輯
                    #20

                    how can I show w1 widget on first monitor and w2 on second?

                    Suggest you take a look at the documentation and examine QWidget::setScreen(QScreen *screen).

                    Software Engineer
                    The Qt Company, Oslo

                    1 條回覆 最後回覆
                    0
                    • A Alexey Serebryakov

                      @mrjj is it correct code?

                      class Widget : public QWidget
                      {
                          Q_OBJECT
                      public:
                           Widget(QWidget *parent = nullptr) : QWidget(parent, Qt::Window) {}
                          ~Widget();
                      };
                      
                      int main(int argc, char *argv[])
                      {
                          QApplication a(argc, argv);
                      
                          Widget w1;
                          Widget w2;
                      
                          w1.show();
                          w1.windowHandle()->setScreen(QApplication::screens()[0]);
                      
                          w2.show();
                          w2.windowHandle()->setScreen(QApplication::screens()[1]);
                      
                          return a.exec();
                      }
                      
                      Z 離線
                      Z 離線
                      zoujiu
                      寫於 最後由 編輯
                      #21

                      @Alexey-Serebryakov thank you

                      1 條回覆 最後回覆
                      0

                      • 登入

                      • Login or register to search.
                      • 第一個貼文
                        最後的貼文
                      0
                      • 版面
                      • 最新
                      • 標籤
                      • 熱門
                      • 使用者
                      • 群組
                      • 搜尋
                      • Get Qt Extensions
                      • Unsolved