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. QDockWidget Window Icon

QDockWidget Window Icon

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.6k 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.
  • P Offline
    P Offline
    pssaransiva
    wrote on last edited by
    #1

    Hi,

    I tried the following code to add a icon to QDockWidget
    

    @
    m_pConsoleDockWidget = new QDockWidget(this);
    m_pConsoleDockWidget->setObjectName(QStringLiteral("Console Dock Widget"));

    m_pConsoleDockWidget->setWindowTitle("Console");
    m_pConsoleDockWidget->setWindowIcon(QIcon("Resources/UI/icons/Console.png"));
    @

    I am not able to see the icon. kindly help me

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Is "Resources/UI/icons/Console.png" in your source folder ? If so, at run time the file won't be found. You would either give the full path or put the image in a Qt resource file and load it from there.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pssaransiva
        wrote on last edited by
        #3

        Hi, Thanks for the reply.
        The resource is in the following path“Resources/UI/icons/Console.png”. I have loaded the resource from Qt resource file. But i am not able to see the icon.

        I have followed the same method for loading the resource for QTabWidgets etc.,, It is working for QTabWidgets. But not for QDockWidgets

        Thanks

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Sorry, I misread your code. QDockWidget doesn't have an window icon

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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