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 remove the need for UI files and build a window entirely with code?
Forum Updated to NodeBB v4.3 + New Features

How to remove the need for UI files and build a window entirely with code?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 341 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello all, hope everything is well! Currently, I am trying to figure out how to remove the need for UI files and build an app in Qt entirely from code. Specifically, I want to be able to create an app with just header and source files. How would I do this?

    1 Reply Last reply
    0
    • ? A Former User

      @sierdzio Thank you very much! Do you know of any examples of this that happen to be on the QT website?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #4

      @WesLow said in How to remove the need for UI files and build a window entirely with code?:

      @sierdzio Thank you very much! Do you know of any examples of this that happen to be on the QT website?

      Yeah, almost all of them do :-)

      • https://doc.qt.io/qt-5/qtwidgets-layouts-basiclayouts-example.html
      • https://doc.qt.io/qt-5/qtwidgets-itemviews-addressbook-example.html
      • https://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html

      (Z(:^

      1 Reply Last reply
      4
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        You just have to use all the UI classes (QHBoxLayout, QVBoxLayout, QWidget, QListView etc.) manually in C++. This is, by the way, exactly what UI files do: they are converted into C++ code by uic and then compiled using normal c++ compiler.

        (Z(:^

        ? 1 Reply Last reply
        3
        • sierdzioS sierdzio

          You just have to use all the UI classes (QHBoxLayout, QVBoxLayout, QWidget, QListView etc.) manually in C++. This is, by the way, exactly what UI files do: they are converted into C++ code by uic and then compiled using normal c++ compiler.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #3

          @sierdzio Thank you very much! Do you know of any examples of this that happen to be on the QT website?

          sierdzioS 1 Reply Last reply
          0
          • ? A Former User

            @sierdzio Thank you very much! Do you know of any examples of this that happen to be on the QT website?

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #4

            @WesLow said in How to remove the need for UI files and build a window entirely with code?:

            @sierdzio Thank you very much! Do you know of any examples of this that happen to be on the QT website?

            Yeah, almost all of them do :-)

            • https://doc.qt.io/qt-5/qtwidgets-layouts-basiclayouts-example.html
            • https://doc.qt.io/qt-5/qtwidgets-itemviews-addressbook-example.html
            • https://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html

            (Z(:^

            1 Reply Last reply
            4
            • JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by
              #5

              I do not use ui files as well. But often it is useful to create test ui files with designer and generate ui_code for help when some layout problems show up.

              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