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. How to get a constant value within the .ui files?

How to get a constant value within the .ui files?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 1.3k 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.
  • C Offline
    C Offline
    cristiano.narcisi
    wrote on last edited by
    #1

    Hi all

    i'm developing my user interface using the form file. I have several EditText objects that have the same dimension. I would like to set it as a constant and apply it to all the objects. This will make changing quicker (i should set the value only one time!!!). I don't want to do it into the .h/.c++ files.

    How can i do it??

    Thanks

    Cristiano

    1 Reply Last reply
    0
    • Ni.SumiN Offline
      Ni.SumiN Offline
      Ni.Sumi
      wrote on last edited by
      #2

      Hi @cristiano-narcisi ,

      Use layout. and add rest all Qtextedit to the same layout.

      1 Reply Last reply
      1
      • C Offline
        C Offline
        cristiano.narcisi
        wrote on last edited by
        #3

        Sorry. Probably i wasn't clear enough. I'd like to define my own set of attributes for a generic object, like a font style ( Bold, size=29 etc etc...) . I was thinking to put it in a single file and apply it setting its reference instead of the raw value. I was thinking to use a Resource, but it seems that i can add only images!

        What can i do?

        Thanks

        Cristiano

        J 1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          hi
          There is no build in object template system in Creator.
          However there is
          http://doc.qt.io/qt-5.5/stylesheet.html
          To allow to change properties based on Classes/types.

          Also, I have a second project that contains some object where I set a lot of
          properties on. I then open a second copy of Designer and simply copy & paste from
          template project to real project.
          That works pretty ok.

          1 Reply Last reply
          2
          • C Offline
            C Offline
            cristiano.narcisi
            wrote on last edited by
            #5

            Thanks! this should be enough for my customization!

            1 Reply Last reply
            0
            • C cristiano.narcisi

              Sorry. Probably i wasn't clear enough. I'd like to define my own set of attributes for a generic object, like a font style ( Bold, size=29 etc etc...) . I was thinking to put it in a single file and apply it setting its reference instead of the raw value. I was thinking to use a Resource, but it seems that i can add only images!

              What can i do?

              Thanks

              Cristiano

              J Offline
              J Offline
              Jakob
              wrote on last edited by
              #6

              @cristiano.narcisi Sounds like you need a stylesheet - you can do very finetuned customization with that.

              Btw, resources are not limited to images. I have an application where I use the global stylesheet through resources.

              1 Reply Last reply
              0

              • Login

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