Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. What did #setupUi do?
Forum Updated to NodeBB v4.3 + New Features

What did #setupUi do?

Scheduled Pinned Locked Moved Solved Qt 6
5 Posts 3 Posters 433 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.
  • J Offline
    J Offline
    JaderoChan
    wrote on last edited by
    #1

    [MT Text]
    I find it strange that some cosmetic changes made to the same Widget before setupUi are quite different from those made after setupUi. Why is this? In my understanding, I have always thought that it roughly parses the ui file designed through qt designer and converts it into the equivalent cpp file (of course these are already done at compile time), but this should not cause this phenomenon ah, is it a bug?
    For example, in some specific cases, calling setStyleSheet after setupUi has no effect, while placing it before setupUi has the desired effect, there is no code yet, but similar problems have been encountered in learning and development.

    If you can clear my mind, I will be very grateful. Thanks!!!

    [Source Text]
    我发现一些很奇怪的现象,有时对于同一个Widget而言,在其setupUi之前对其进行某些外观上的调整与在setupUi之后所呈现的效果大相径庭,这是为什么?以我的理解,我一直认为它粗略来讲是解析了通过qt designer设计出的ui文件并将其转换成等效的cpp文件(当然这些是编译时就已经完成了的),但是这不应该造成这种现象啊,难道是bug?
    举一个例子,在某些特定的时候,在setupUi之后调用setStyleSheet没有任何效果,而将其放置在setupUi之前则产生了预期效果,暂时还没有代码,但是在学习和开发中确实遇到过类似的问题。

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I think what would be best for you is to go read the content of setupUi. This method will create the items you added in designer and set their properties. Nothing you couldn't code yourself once you get used to it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        I think what would be best for you is to go read the content of setupUi. This method will create the items you added in designer and set their properties. Nothing you couldn't code yourself once you get used to it.

        J Offline
        J Offline
        JaderoChan
        wrote on last edited by
        #3

        @SGaist Ok, thank you reply. Can you give me the related link you above refer setupUi source, very much!!!

        jsulmJ 1 Reply Last reply
        0
        • J JaderoChan

          @SGaist Ok, thank you reply. Can you give me the related link you above refer setupUi source, very much!!!

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JaderoChan said in What did #setupUi do?:

          Can you give me the related link you above refer setupUi source,

          It is inside the build folder of your project...
          You should read https://doc.qt.io/qt-6/designer-using-a-ui-file.html

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          1
          • jsulmJ jsulm

            @JaderoChan said in What did #setupUi do?:

            Can you give me the related link you above refer setupUi source,

            It is inside the build folder of your project...
            You should read https://doc.qt.io/qt-6/designer-using-a-ui-file.html

            J Offline
            J Offline
            JaderoChan
            wrote on last edited by
            #5

            @jsulm Ok, thank you!

            1 Reply Last reply
            0
            • J JaderoChan 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