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. QMainWindow: Minimize to dash board on Ubuntu 18.04

QMainWindow: Minimize to dash board on Ubuntu 18.04

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 385 Views
  • 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.
  • A Offline
    A Offline
    anshah
    wrote on last edited by
    #1

    I want to minimize a QMainWindow to an icon on the dash board on the left side of the screen on Ubuntu 18.04.

    When the "show()" function is called and the QMainWindow is visible I see the icon for my application on the left side dash.

    However, when the "hide()" function is called on QMainWindow the application is no longer visible which is fine but the dashboard icon also disappears. I want to minimize so that the application is no longer visible but there is still a dash board icon.

    JonBJ 1 Reply Last reply
    0
    • A anshah

      I want to minimize a QMainWindow to an icon on the dash board on the left side of the screen on Ubuntu 18.04.

      When the "show()" function is called and the QMainWindow is visible I see the icon for my application on the left side dash.

      However, when the "hide()" function is called on QMainWindow the application is no longer visible which is fine but the dashboard icon also disappears. I want to minimize so that the application is no longer visible but there is still a dash board icon.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @anshah
      For minimization and icon, you need to use QMainWindow::showMinimized(), not QMainWindow::hide().

      A 1 Reply Last reply
      0
      • JonBJ JonB

        @anshah
        For minimization and icon, you need to use QMainWindow::showMinimized(), not QMainWindow::hide().

        A Offline
        A Offline
        anshah
        wrote on last edited by anshah
        #3

        @JonB
        I am now able to see the icon when minimizing.

        So there is still one small problem. My application has been using a QSystemTrayIcon to show/hide the main window. When the Main Window is visible I have it minimizing to an icon now. The problem is in order to have the Main Window display again I need to click on the Dash Board minimized icon now. The QSystemTrayIcon is not responsive when the Main Window is in minimized state. I would like the Main Window to come up with either Dash Board icon or QSystemTrayIcon.

        Here's my code:

        connect(m_pTrayIcon,   SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                this,          SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
        
        // Slot to handle tray icon activated signal
        void MyMainWindow::onActivated(QSystemTrayIcon::ActivationReason r)
        {	
            if (r == QSystemTrayIcon::Trigger)
            {
                if (!this->isVisible() || this->isMinimized())
                {
                    this->show();
                }
                else
                {
                    this->showMinimized();
                }
            }
        }
        
        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