<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Error in QMenu style]]></title><description><![CDATA[<p dir="auto">When I start my project, the top line(Menu) doesn't fill out completely, how do I resolve it?<br />
! <a href="https://yadi.sk/i/o_4_wJH23Jk3yS" target="_blank" rel="noopener noreferrer nofollow ugc">picture</a></p>
]]></description><link>https://forum.qt.io/topic/79860/error-in-qmenu-style</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 22:53:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/79860.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Jun 2017 19:47:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Error in QMenu style on Sat, 03 Jun 2017 10:07:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joeq">@<bdi>joeQ</bdi></a> Part of the code below</p>
]]></description><link>https://forum.qt.io/post/397139</link><guid isPermaLink="true">https://forum.qt.io/post/397139</guid><dc:creator><![CDATA[TETTRA]]></dc:creator><pubDate>Sat, 03 Jun 2017 10:07:41 GMT</pubDate></item><item><title><![CDATA[Reply to Error in QMenu style on Fri, 02 Jun 2017 04:43:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dheerendra">@<bdi>dheerendra</bdi></a><br />
Source:</p>
<pre><code class="language-//menuBar(Add">    menuBar()-&gt;setStyleSheet(StyleHelper::getQMenuStyleSheet());

    //file
     QMenu *file = menuBar()-&gt;addMenu(tr("File"));
      file-&gt;setStyleSheet(StyleHelper::getMenuBarStyleSheet());

       //new
        QAction *newFile = new QAction (tr("New"),this);
          newFile-&gt;setShortcut(QKeySequence::New);
          connect(newFile,SIGNAL(triggered()),this,SLOT(newfile()));
          file-&gt;addAction(newFile);

       //open
        QAction *openFile = new QAction (tr("Open"),this);
          openFile-&gt;setShortcut(QKeySequence::Open);
          connect(openFile,SIGNAL(triggered()),this,SLOT(open()));
          file-&gt;addAction(openFile);

       //the last document
         QAction *lastFile = new QAction (tr("The last document"),this);

            file-&gt;addAction(lastFile);
             file-&gt;addSeparator();

       //save
         QAction *saveFile = new QAction (tr("Save"),this);
            saveFile-&gt;setShortcut(QKeySequence::Save);

            file-&gt;addAction(saveFile);

       //save as
         QAction *saveAsFile = new QAction (tr("Save as"),this);
            saveAsFile-&gt;setShortcut(QKeySequence::SaveAs);
            connect(saveAsFile,SIGNAL(triggered()),this,SLOT(saveAs()));
            file-&gt;addAction(saveAsFile);
             file-&gt;addSeparator();

       //place
         QAction *placeFile = new QAction (tr("Place"),this);

             file-&gt;addAction(placeFile);
              file-&gt;addSeparator();

       //print
         QAction *printFile = new QAction (tr("Print"),this);
             printFile-&gt;setShortcut(Qt::CTRL+Qt::Key_P);
             connect(printFile,SIGNAL(triggered()),this,SLOT(printf()));
              file-&gt;addAction(printFile);
               file-&gt;addSeparator();

       //exit
         QAction *exitFile = new QAction (tr("Exit"),this);
             exitFile-&gt;setShortcut(Qt::CTRL+Qt::Key_Q);
             connect(exitFile,SIGNAL(triggered()),this,SLOT(close()));
             file-&gt;addAction(exitFile);



    //edit

      QMenu *edit = menuBar()-&gt;addMenu(tr("&amp;Edit"));
      edit-&gt;setStyleSheet(StyleHelper::getMenuBarStyleSheet());

       //cancel
         QAction *cancelFile = new QAction (tr("Cancel"),this);
             cancelFile-&gt;setShortcut(Qt::CTRL+Qt::Key_Z);
             edit-&gt;addAction(cancelFile);

      //undo
         QAction *undoFile = new QAction (tr("Undo"),this);
             undoFile-&gt;setShortcut(Qt::ALT+Qt::CTRL+Qt::Key_Z);
             edit-&gt;addAction(undoFile);
             edit-&gt;addSeparator();

      //cut
         QAction *cutFile = new QAction (tr("Cut"),this);
             cutFile-&gt;setShortcut(Qt::CTRL+Qt::Key_X);
             edit-&gt;addAction(cutFile);

      //copy
         QAction *copyFile = new QAction (tr("Copy"),this);
              copyFile-&gt;setShortcut(Qt::CTRL+Qt::Key_C);
              edit-&gt;addAction(copyFile);

      //insert
         QAction *insertFile = new QAction (tr("Insert"),this);
               insertFile-&gt;setShortcut(Qt::CTRL+Qt::Key_V);
               edit-&gt;addAction(insertFile);

      //clear
         QAction *clearFile = new QAction (tr("Clear"),this);

                edit-&gt;addAction(clearFile);
                edit-&gt;addSeparator();



    //window

       QMenu *window = menuBar()-&gt;addMenu(tr("&amp;Window"));
       window-&gt;setStyleSheet(StyleHelper::getMenuBarStyleSheet());

       //full screen mode
         QAction *fsm = new QAction (tr("Full screen mode"),this);
             fsm-&gt;setShortcut(Qt::Key_F5);
             connect(fsm,SIGNAL(triggered()),this,SLOT(f_fsm()));
             window-&gt;addAction(fsm);


    //reference

       QMenu *reference = menuBar()-&gt;addMenu(tr("&amp;Reference"));
       reference-&gt;setStyleSheet(StyleHelper::getMenuBarStyleSheet());

      //About the program "Project"
         QAction *atp = new QAction (tr("About the program Project"),this);
             connect(atp,SIGNAL(triggered()),this,SLOT(about()));
             reference-&gt;addAction(atp);
</code></pre>
<p dir="auto">Style:</p>
<pre><code>QString StyleHelper::getQMenuStyleSheet()
{
    return "QMenuBar {"
           "background-color: #000000;"
           "color: #FFFFFF;"
           "}"
           "QMenuBar::item:selected {"
           "background-color: #6B6B6B"
           "}";
}


QString StyleHelper::getMenuBarStyleSheet()
{
    return "QMenu { "
           "background-color: #373737; "
           "border: #000000;"
           "color:#FFFFFF;"
           "}"
           "QMenu::item:selected {"
           "background-color: #6E6E6E"
           "}";
}
</code></pre>
]]></description><link>https://forum.qt.io/post/396917</link><guid isPermaLink="true">https://forum.qt.io/post/396917</guid><dc:creator><![CDATA[TETTRA]]></dc:creator><pubDate>Fri, 02 Jun 2017 04:43:23 GMT</pubDate></item><item><title><![CDATA[Reply to Error in QMenu style on Fri, 02 Jun 2017 04:16:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Window</p>
]]></description><link>https://forum.qt.io/post/396912</link><guid isPermaLink="true">https://forum.qt.io/post/396912</guid><dc:creator><![CDATA[TETTRA]]></dc:creator><pubDate>Fri, 02 Jun 2017 04:16:40 GMT</pubDate></item><item><title><![CDATA[Reply to Error in QMenu style on Fri, 02 Jun 2017 02:16:13 GMT]]></title><description><![CDATA[<p dir="auto">It could be that you are using "Exit" "Close" or "Quit" etc which may be same as menu options given by MAC or Ubuntu. They may not show up. OR You may be creating Actions and not adding to MenuBar. As requested by others already, code snippet will help us to resolve the issue.</p>
]]></description><link>https://forum.qt.io/post/396902</link><guid isPermaLink="true">https://forum.qt.io/post/396902</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Fri, 02 Jun 2017 02:16:13 GMT</pubDate></item><item><title><![CDATA[Reply to Error in QMenu style on Fri, 02 Jun 2017 00:55:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tettra">@<bdi>TETTRA</bdi></a> Hi, friend, can you show some code snippets?</p>
]]></description><link>https://forum.qt.io/post/396897</link><guid isPermaLink="true">https://forum.qt.io/post/396897</guid><dc:creator><![CDATA[joeQ]]></dc:creator><pubDate>Fri, 02 Jun 2017 00:55:32 GMT</pubDate></item><item><title><![CDATA[Reply to Error in QMenu style on Thu, 01 Jun 2017 20:23:20 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">What OS and Window manager are you using ?</p>
]]></description><link>https://forum.qt.io/post/396874</link><guid isPermaLink="true">https://forum.qt.io/post/396874</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 01 Jun 2017 20:23:20 GMT</pubDate></item></channel></rss>