Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLabel not update, when the parent widget is Qt::FramelessWindowHint
Forum Updated to NodeBB v4.3 + New Features

QLabel not update, when the parent widget is Qt::FramelessWindowHint

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 539 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GaoboG Offline
    GaoboG Offline
    Gaobo
    wrote on last edited by
    #1

    Hi, I create a QDialog, and put a QLabel into the dialog, set the QLabel word wrap, when i revoke the function this->setWindowFlag(Qt::FramelessWindowHint); , and reset the text of QLabel by call setText, it not update the text .
    but if i don't set the FramelessWindowHint flag, the QLabel update normally;
    My Qt's Version is 5.15.2, system version is Windows10.

        QString strWinDesktopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
    
        auto selectDir = QFileDialog::getExistingDirectory(this, tr("Select Dirctory"), ui->savePathLabel->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
    
        if (selectDir.isEmpty())
        {
            return;
        }
    
        ui->savePathLabel->setText(selectDir);
    
    
    

    if i call qApp->processEvent() , the text is update, and qlabel wrap the text, but the height is not suitable.
    79c37cd2-4b39-4789-a2c5-8b6bd504b7e5-image.png

    1 Reply Last reply
    0
    • Axel SpoerlA Online
      Axel SpoerlA Online
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Hi,
      Qt 5.15.2 is long outdated, please try Qt 6.5 or newer.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      0
      • GaoboG Offline
        GaoboG Offline
        Gaobo
        wrote on last edited by
        #3

        Oh, I don't want to update the version of my project, is that question a bug of Qt5.15.2?

        Christian EhrlicherC 1 Reply Last reply
        0
        • GaoboG Gaobo

          Oh, I don't want to update the version of my project, is that question a bug of Qt5.15.2?

          Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #4

          @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

          s that question a bug of Qt5.15.2?

          Since you did not provide a minimal, compilable example of your problem I would say no - it's a problem of your code.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          GaoboG 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

            s that question a bug of Qt5.15.2?

            Since you did not provide a minimal, compilable example of your problem I would say no - it's a problem of your code.

            GaoboG Offline
            GaoboG Offline
            Gaobo
            wrote on last edited by
            #5

            @Christian-Ehrlicher said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

            @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

            s that question a bug of Qt5.15.2?

            Since you did not provide a minimal, compilable example of your problem I would say no - it's a problem of your code.

            so, how do i solve this problem? if not set FramelessWindowHint, everything is ok. Can you give me some reasons why this might be happening or some directions I can troubleshoot this issue? thanks

            Christian EhrlicherC 1 Reply Last reply
            0
            • GaoboG Gaobo

              @Christian-Ehrlicher said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

              @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

              s that question a bug of Qt5.15.2?

              Since you did not provide a minimal, compilable example of your problem I would say no - it's a problem of your code.

              so, how do i solve this problem? if not set FramelessWindowHint, everything is ok. Can you give me some reasons why this might be happening or some directions I can troubleshoot this issue? thanks

              Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

              so, how do i solve this problem?

              How should we know when you don't show us what exactly you are doing?
              Create a minimal reproduce of your problem. From your description I would guess it's not more than 30 lines.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              GaoboG 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

                so, how do i solve this problem?

                How should we know when you don't show us what exactly you are doing?
                Create a minimal reproduce of your problem. From your description I would guess it's not more than 30 lines.

                GaoboG Offline
                GaoboG Offline
                Gaobo
                wrote on last edited by
                #7

                @Christian-Ehrlicher said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

                @Gaobo said in QLabel not update, when the parent widget is Qt::FramelessWindowHint:

                so, how do i solve this problem?

                How should we know when you don't show us what exactly you are doing?
                Create a minimal reproduce of your problem. From your description I would guess it's not more than 30 lines.

                ok, i try to reproduce this problem, thanks

                1 Reply Last reply
                0
                • GaoboG Gaobo has marked this topic as solved on

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved