qmainwindow

Passing/giving commands to CMD through Qt GUI

自闭症网瘾萝莉.ら 提交于 2019-12-11 16:47:46
问题 What I'm trying to achieve (And struggling with) is basically passing commands to CMD through my QT Mainwindow application. I would like to have my code, first run CMD (preferably hidden). I used here QProcess like this: (in my Mainwindow.cpp file) QString exePath = "C:/Windows/System32/cmd.exe"; QProcess pro; pro.startDetached(exePath); pro.waitForStarted(); this question helped me a lot However, what this answer/question lacks is actual help on "appending" commands to CMD (not sure if this

reducing the width of QMenuBar and QToolBar in mainWindow

♀尐吖头ヾ 提交于 2019-12-11 15:00:01
问题 In my MainWindow ,menuBar contents and toolBar contents are few that it will occupy only a small portion in the left side off the main window and the rest of the portion is left empty. Im having a info frame with some widgets in it in the right side of the centerwidget. my question is that can i use the the info frame from the menu bar space itself as menubar and toolbar can occupy only left portion of the mainwindow and i can use the entire right portion for info frame..? 回答1: You can't use

MainWindow Widget Resize (Pyside)

≯℡__Kan透↙ 提交于 2019-12-11 11:28:51
问题 I have a problem with the resize of the MainWindow of a GUI Application. This is what i see when i try to run the Application: Link Image 1 and what happen when i try to resize it with the mouse: Link Image 2 I would like that, when i try to resize the MainWindow it shows the Widget inside like the first image i showed before instead have that large spacing between each "label". If it can help this is the code: Link Code You can go straigth on to the functions setUi(), setGridUI(), ignoring

Qt: HBoxLayout - stop MainWindow from resizing to contents

这一生的挚爱 提交于 2019-12-11 10:03:36
问题 It seems most people are asking how to make their QMainWindow resize to its contents - I have the opposite problem, my MainWindow does resize and I don't know why. When I set my QLabel to a longer text, my mainwindow suddenly gets bigger, and I can't find out why that happens. The following example code basically contains: A QMainWindow A QWidget as central widget A QVBoxLayout as a child of that A LabelBar inside that. The LabelBar is a QWidget which in turn contains: A QHBoxLayout Two

QTableView not expanding/reducing when QMainWindow is resized

强颜欢笑 提交于 2019-12-11 09:04:24
问题 I have a QMainWindow. Inside the QMainWindow, I have a central widget. For the central widget, I have a QVBoxLayout. To this QVBoxLayout, I've added 3 widgets. One is a widget with some labels, which has a QGridLayout. The other is a horizontal line. The third is a QTableView. The problem is that when I try and expand the QMainWwindow, despite whatever resize policy I set ( or not), the TableView does not expand, and it leaves an ungainly blank area in the rest of the expanded QMainWindow.

QDockWidget splitter jumps when QMainWindow Resized

∥☆過路亽.° 提交于 2019-12-11 07:36:40
问题 In an old program of mine, I have 2-column QTableWidget inside of a QDockWidget. Building it in modern times (Qt 5.10) I seem to have to override the table's sizeHint() to get it to be a width besides 100px or something. Which was a bit annoying (didn't need this before--why isn't the table's width via headers the default?) But with that tweaked, there's now another nuisance: if the user does any moving of the splitter for the dock widget, it will be lost on any window resize. I made a little

react on the resizing of a QMainWindow for adjust widget's size

对着背影说爱祢 提交于 2019-12-11 01:11:58
问题 How do I react on the resize of a QMainWindow ? I have QTextBrowsers in a QScrollArea and I adjust them to the size of the content on creating them (the only thing that should scroll is the QScrollArea ). Everything works for now, but if I resize the mainWindow , the height of the QTextBrowsers isn't changed, because the reflow function isn't triggered. Do you have any better idea to adjust a QTextBrowser to it's content? My current code is: void RenderFrame::adjustTextBrowser(QTextBrowser* e

How to keep my QMainWindow always inside of the desktop?

青春壹個敷衍的年華 提交于 2019-12-10 17:32:57
问题 I want to keep my QMainWindow always inside of the desktop, so I add the implementation for QMainWindow::moveEvent : void MainWindow::moveEvent(QMoveEvent *ev) { if(ev->pos().x() < 0) setGeometry(0, ev->oldPos().y(), width(), height()); } But when I move the window to out of desktop left bounding, the app is crashed. What is wrong with this code? Why it is crashed? Is my solution correct? //--Update: I tried with this: int newx = ev->pos().x(), newy = ev->pos().y(); if(ev->pos().x() < 0) newx

Set background of QMainWindow central widget

a 夏天 提交于 2019-12-10 15:57:40
问题 Using Qt 4.8.4 on Windows 7 (MSVC 2010) I have a standard QMainWindow in my app with a toolbar. I want the toolbar to stay grey, but the central widget should have a white background. Calling centralWidget->setStyleSheet("background-color: white;") at first seemed to do the job, but using it with a Designer-generated widget (a Q_OBJECT ) doesn't. Subsequently I toyed around with various other methods to set a style sheet (also using Designer) to no avail. To see this effect, add or remove the

How keep a QWidget always on top?

蓝咒 提交于 2019-12-08 16:55:27
问题 I have two buttons on my QMainWindow. One to btnShowKb and another btnHideKb. When i press btnShowKb it shows an QWidget. I want this QWidget always to be on top of all windows till I press btnHideKb. When its on top, I want both QWidget and QMainWidget be activated. Can anybody suggest on this? 回答1: Setting the setWindowFlags() with Qt::WindowStaysOnTopHint is meant to help. https://doc.qt.io/archives/qt-4.7/qt.html#WindowType-enum https://doc.qt.io/archives/qt-4.7/widgets-windowflags.html