Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:38:32+00:00 2026-05-30T07:38:32+00:00

Qt :: WindowFlags flags = 0; // Makes the Pomodoro stay on the top

  • 0
    Qt :: WindowFlags flags = 0;

    // Makes the Pomodoro stay on the top of all windows.
    flags |= Qt :: WindowStaysOnTopHint;

    // Removes minimize, maximize, and close buttons.
    flags |= Qt :: WindowTitleHint | Qt :: CustomizeWindowHint;

    window->setWindowFlags (flags);
    window->setWindowTitle ("Failing to plan is planning to fail");

This removes minimize, maximize, and close buttons. The default menu on the left is still there. How to get rid of that?

I want the title bar to be there, but just want the menu to be removed.

Default menu contains: Minimize, Maximize, Move etc options.

EDIT 1:

timer.cpp

#include <QApplication>
#include <QMainWindow>
#include "timer.h"

#include <QPushButton>
#include <QListWidget>
#include <QtGui>
#include <QTreeWidget>
int main(int argc, char *argv[])
{
    QApplication    app (argc, argv);

    // The window on which we will place the timer.
    QMainWindow *window           = new QMainWindow();
    QWidget           *centralWidget = new QWidget (window);

    /* Button widget */
    // Displays a button on the main window.
    QPushButton   *startButton     = new QPushButton("Start", window);
    // Setting the size of the button widget.
    startButton->setFixedSize (245, 25);

    /* Text box */
    // Displays a time interval list on the main window.
    QListWidget *timeIntervalList = new QListWidget (window);
    timeIntervalList->setFixedSize (30, 145);

    QStringList timeIntervals;
    timeIntervals << "1" << "20" << "30" << "40";
    timeIntervalList->addItems (timeIntervals);

    /* LCD widget */
    // Start Counting down from 25 minutes
    lcdDisplay *objLcdDisplay = new lcdDisplay (centralWidget);
    // Setting the size of the LCD widget.
    objLcdDisplay->setFixedSize (245, 140);

    // The clicked time interval should be returned from the list to the timer.
    QObject :: connect (timeIntervalList, SIGNAL (itemClicked (QListWidgetItem *)), objLcdDisplay, SLOT (receiveTimeInterval (QListWidgetItem *)));

    // The timer should start and emit signals when the start button is clicked.
    QObject :: connect (startButton, SIGNAL (clicked ()), objLcdDisplay, SLOT (setTimerConnect ()));

    *************************************************************************
    Qt :: WindowFlags flags = 0;
    // Makes the Pomodoro stay on the top of all windows.
    flags |= Qt :: Window | Qt :: WindowStaysOnTopHint;
    // Removes minimize, maximize, and close buttons.
    flags |= Qt :: WindowTitleHint | Qt :: CustomizeWindowHint;
    window->setWindowFlags (flags);
    *************************************************************************
    window->setWindowTitle   ("Failing to plan is planning to fail");

    QGridLayout *layout = new QGridLayout();
    centralWidget->setLayout(layout);

    //Add Items to QGridLayout Here 
    //Row and Column counts are set Automatically
    layout->addWidget (objLcdDisplay, 0, 1);
    layout->addWidget (startButton, 1, 1);
    layout->addWidget (timeIntervalList, 0, 0);

    window->setCentralWidget (centralWidget);
    window->show();

    return app.exec();
}

Timer.h

#ifndef  LCDNUMBER_H
#define LCDNUMBER_H

#include <QLCDNumber>
#include <QTimer>
#include <QTime>
#include <QListWidget>
#include <QMessageBox>
#include <iostream>

class lcdDisplay : public QLCDNumber
{
    Q_OBJECT  

    public:
        // The QTimer class provides repetitive and single-shot timers.
        QTimer* objTimer;
        // The QTime class provides clock time functions.
        QTime*  objTime;

    public:
        lcdDisplay (QWidget *parentWidget)
        {
            objTimer = new QTimer ();
            // Setting our own time with the specified hours, minutes, and seconds.
            objTime  = new QTime  (0, 0, 0);

            setParent (parentWidget);
        };

        ~ lcdDisplay () {};

    public slots:
        // This slot is called after the timer timeouts (1 second).
        void setDisplay ()
        {
            // TODO
            objTime->setHMS (0, objTime->addSecs (-1).minute (), objTime->addSecs (-1).second ());
            display (objTime->toString ());

            if ((objTime->minute () == 0) && (objTime->second () == 0)) 
            {
                objTimer->stop ();
                QMessageBox msgBox;
                msgBox.setWindowTitle ("Pomodoro");
                msgBox.setText ("Time's up.");
                msgBox.setWindowModality(Qt::ApplicationModal);
                msgBox.exec();
            }
        };

        void receiveTimeInterval (QListWidgetItem *item)
        {
            QString h = item->text();
            objTime->setHMS (0, h.toUInt(), 0);
        }

        void setTimerConnect ()
        {
            // connect (objectA, signalAFromObjectA, objectB, slotAFromObjectB)
            // timeout (): This signal is emitted when the timer times out. The time out period can be specified with `start (int milliseconds)` function.
            QObject :: connect (objTimer, SIGNAL (timeout ()), this, SLOT (setDisplay ()));

            // 1 second has 1000 milliseconds.
            // start (int milliseconds): Starts the timer with a timeout interval of specified milliseconds. this means that after 1 second the timer will emit a signal. TODO placement
            objTimer->start (1000);
        }
};
#endif
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:38:33+00:00Added an answer on May 30, 2026 at 7:38 am

    This is working for me:

    Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint
    

    Screen shot

    Sometimes you have to specify these in the constructor of the window for them to take effect. If you assign them later (setWindowFlags), some of the settings may not apply.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

void MainWindow::on_actionAlways_on_Top_triggered(bool checked) { Qt::WindowFlags flags = this->windowFlags(); if (checked) { this->setWindowFlags(flags | Qt::CustomizeWindowHint
From here: http://doc.qt.io/qt-4.8/qt-widgets-windowflags-example.html if (flags & Qt::MSWindowsFixedSizeDialogHint) text += \n| Qt::MSWindowsFixedSizeDialogHint; if (flags &
I have a certain QWidget derived class. Look at the window flags i'm giving
I'd like to have the same effect as the windows 7 taskbar. I've looked
I'm trying to add a minimize button to my QDialog using this code in
I need to integrate a DirectX9 device in a C++ Windows Form - how
First of all, sorry for my ignorance of the window creation process. Today is
I tried this: #include <windows.h> #pragma comment(linker,/manifestdependency:\type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\) LRESULT CALLBACK
I'm embedding WebKit in a Windows C++ Application. I'm using the Cairo port. It
If I have a class which inherits QMainWindow, and I want it to only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.