c++ - removing white separator form between QMenu and QToolBar -
i have written qmenu , qtoolbar in qt. that's got:
i can't find way remove white separator between qmenu(file, edit) , qtoolbar(two buttons piano icons).
code:
mainwindow::mainwindow() { this->setstylesheet("background-color: black;"); initmenu(); initbuttons(); } void mainwindow::initmenu() { menubar()->setstylesheet("background: #555555; " "color: #eeeeee; " "selection-background-color: #222222; " "border-color:#eeeeee;"); qmenu *filemenu = menubar()->addmenu("file"); qaction *newfileaction = new qaction("new", this); newfileaction->setshortcut(qkeysequence::new); newfileaction->setstatustip("create new file."); //connect filemenu->addaction(newfileaction); qaction *openfileaction = new qaction("open", this); openfileaction->setshortcut(qkeysequence::open); openfileaction->setstatustip("open file."); //connect filemenu->addaction(openfileaction); qaction *savefileaction = new qaction("save", this); savefileaction->setshortcut(qkeysequence::save); savefileaction->setstatustip("save file."); //connect filemenu->addaction(savefileaction); qaction *saveasfileaction = new qaction("save as", this); saveasfileaction->setshortcut(qkeysequence::saveas); saveasfileaction->setstatustip("save file file."); //connect filemenu->addaction(saveasfileaction); filemenu->addseparator(); qaction *quitaction = new qaction("quit", this); quitaction->setshortcut(qkeysequence::quit); quitaction->setstatustip("quit program."); //connect filemenu->addaction(quitaction); qmenu *editmenu = menubar()->addmenu("edit"); qaction *copyaction = new qaction("copy", this); copyaction->setshortcut(qkeysequence::copy); copyaction->setstatustip("copy."); //connect editmenu->addaction(copyaction); } void mainwindow::initbuttons() { qtoolbar *buttontoolbar = addtoolbar("buttons"); buttontoolbar->setstylesheet("background: #555555"); buttontoolbar->setmovable(false); const qicon pianoicon = qicon::fromtheme("piano-roll",qicon(":/buttons/b_piano.png")); qaction *pianoaction = new qaction(pianoicon, tr("&piano roll"), this); pianoaction->setshortcut(qkeysequence(qt::ctrl + qt::key_1)); pianoaction->setstatustip("opens piano roll window."); //connect(); buttontoolbar->addaction(pianoaction); const qicon piano2icon = qicon::fromtheme("piano-roll2",qicon(":/buttons/i_piano.png")); qaction *piano2action = new qaction(piano2icon, tr("&piano roll"), this); piano2action->setshortcut(qkeysequence(qt::ctrl + qt::key_2)); piano2action->setstatustip("opens piano roll window number two."); //connect(); buttontoolbar->addaction(piano2action); }
in mainwindow run 2 functions. first function creates qmenu. second 1 creates qtoolbar 2 buttons.
Comments
Post a Comment