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

  • 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??



  • Hi @cristiano-narcisi ,

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

  • 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?



  • Qt Champions 2017

    There is no build in object template system in Creator.
    However there is
    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.

  • Thanks! this should be enough for my customization!

  • @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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.