Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Icons from system theme
Forum Updated to NodeBB v4.3 + New Features

Icons from system theme

Scheduled Pinned Locked Moved Qt Creator and other tools
8 Posts 3 Posters 8.5k 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.
  • M Offline
    M Offline
    miscreant
    wrote on last edited by
    #1

    Is there any way to use icons from the system theme in a .ui file?

    I know how to use QIcon::fromTheme() when I'm writing code in C++ but I need a way to do the same thing in a Qt Designer .ui file. I know I can manually edit the C++ header file that is generated from the .ui file but doing it that way means I'd have to edit the header file whenever I make a change to the .ui file in Qt Designer.

    Anyone have any ideas how I can do this?

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      Modifying generated header files is usually not the best idea.

      Include that generated header in your c++ file and then set a button's icon -- ui->button->setIcon(...) , would that work out for you?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miscreant
        wrote on last edited by
        #3

        That would work, although it would mean that I couldn't create a window that has any buttons with icons just be calling someDialog->show();

        1 Reply Last reply
        0
        • ? This user is from outside of this forum
          ? This user is from outside of this forum
          Guest
          wrote on last edited by
          #4

          you could try to set the icons before calling dialog->show()

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            Why can't you do the necessary setup in the dialog's constructor, right after the UI was set up? @dialog->show()@ does work fine that way.

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #6

              yes agreed! dialog constructor is better place to do this :)

              1 Reply Last reply
              0
              • M Offline
                M Offline
                miscreant
                wrote on last edited by
                #7

                Good idea, I'll try that

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  Friedemann.Kleint
                  wrote on last edited by
                  #8

                  See "QTBUG-7777":http://bugreports.qt.nokia.com/browse/QTBUG-7777. It is planned for 4.8

                  [ Turned URL into a link, tobias ]

                  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