Results 1 to 2 of 2

Thread: Two UI files, one header/CPP - is it possible?

  1. #1
    Join Date
    Feb 2015
    Posts
    3
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Two UI files, one header/CPP - is it possible?

    Dear all,

    I have an question regarding resizing the window as I have to provide my app for a desktop or laptop user. The app is a rebuild of an app built in India but with a lot of modifications (and different programming language). The layout in the original app is not resize friendly and this is mostly a copy, but I am aware that I may need to spend time and make it layout (ie, resize) friendly.

    My application only requires two sizes: desktop or laptop - nothing in between. Unfortunately the laptops connect to desktop monitors at work and users would then want a full screen app, so an initial idea of creating two apps is no good.

    My question for all you good people is this:
    Is there a way that I can use two UI files with one Header/CPP file, with the ability to swap between them depending on what screen resolution is detected when each UI file is loaded? Everything on both UI files will be identical except for the layouts, as one will be laptop friendly.

    I have seen the QtUiTools module and this could possibly be my solution, although I would probably have to change some code to accomodate this (I haven't looked too closely yet), so if it is possible with the UI's compiled into the program this would be better.

    I am only at the exploring stage while I build the app for the desktop but I am thinking this is not possible. Can you advise? How do people handle this type of situation?

    Regards,

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Two UI files, one header/CPP - is it possible?

    You have the whole expressiveness of C++ at hand, including inheritance. Have a base class defining the logic of the application and two subclasses providing two version of the user interface. Then you will be able to decide which UI to show by instantiating one or the other.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    LostSoul (24th April 2015)

Similar Threads

  1. QMake Precompiled header with both C and C++ files
    By Ermoghen in forum Qt Tools
    Replies: 0
    Last Post: 22nd April 2015, 15:49
  2. Header Files
    By Maluko_Da_Tola in forum Newbie
    Replies: 1
    Last Post: 2nd October 2010, 13:04
  3. Replies: 2
    Last Post: 30th September 2010, 13:26
  4. header files problems
    By dognzhe in forum General Programming
    Replies: 1
    Last Post: 18th May 2009, 09:00
  5. header files not getting included
    By nimmyj in forum Installation and Deployment
    Replies: 1
    Last Post: 19th December 2006, 07:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.