qwidget

QStyledItemDelegate drawing custom widget failed

半城伤御伤魂 提交于 2019-12-07 12:56:11
问题 In one of my projects I'm using a QTableWidget in order to display some complex computational results. In order to increase the readability of the table I'm in need to display two aligned values inside of a single table cell. Later on I want to customize the widget even more by using colors or arrows etc.. For this I derived from QStyledItemDelegate and I called table ->setItemDelegate(new TwoNumbersDelegate) on my QTableWidget instance. For some reasons the QFrame is never display. I really

Painting Issue on QWidget outsite GUI thread

我怕爱的太早我们不能终老 提交于 2019-12-07 12:21:09
问题 I am developing an appliation in which I want to continuously receive images from remote host and display them on my screen. for this I am following the given strategy 1) I have a main QWidget object which contains the QImage on it (works fine) 2) Images received from remote host are painted on QImage object, this work is done in a worker thread using QPainter. (works fine) 3) but the problem is that the image is not updated on QWidget, unless I resize the widget, because the repaint event is

QTreeWidget editItem fails with “edit: editing failed”

岁酱吖の 提交于 2019-12-07 08:41:14
问题 I have a QTreeWidgetItem added to a QTreeWidget : QTreeWidgetItem* item = new QTreeWidgetItem(ui->trwPairs); item->setFlags(item->flags() | Qt::ItemIsEditable); If the item is edited, I want to do a few checks on the new value: Pairs::Pairs(QWidget *parent) : QWidget(parent), ui(new Ui::Pairs) { ui->setupUi(this); connect(this->ui->trwPairs, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(Validate(QTreeWidgetItem*,int))); } void Pairs::Validate(QTreeWidgetItem* item, int column) { if

Resize QStackedWidget to the page which is opened [duplicate]

北战南征 提交于 2019-12-07 04:49:42
问题 This question already has answers here : Qt QStackedWidget Resizing Issue (3 answers) Closed 5 years ago . I want my QStackedWidget to resize to the page which is opened. I got a lot of widgets attached to the first page, but the rest pages have only one button. So they stay so big, and the first page is ok. How can I make my QStackedWidget to have the size of the page being viewed. The reason why i want to do this is that I have three different options, and after that I have other things. If

active resizing of widgets inside mainwindow

不羁的心 提交于 2019-12-07 04:02:44
问题 I have a few widgets in a main window. i want the user to be able to resize the widgets inside the window as they please, just like how one would resize the main window. Do I have to make a layout container to enable this? or ....layout? Buh the layout contains are static once the window is rendered. In the picture the three widgets should be enable with resizing such that the user can drag their sides/corners to expand or minimize the widget size. 回答1: One thing you could do is to use some

PyQt5 - Add image in background of MainWindow layout

Deadly 提交于 2019-12-06 14:27:36
问题 New to PyQt5... Here is a very basic question. I would like to add an image inside the layout of a widget. This widget is the Main Window / root widget of my application. I use the following code, but I get an error message. import sys from PyQt5.QtGui import QImage from PyQt5.QtWidgets import * class MainWindow(QWidget): def __init__(self): super().__init__() self.setGeometry(300,300,300,220) self.setWindowTitle("Hello !") oImage = QImage("backgound.png") oLayout = QVBoxLayout() oLayout

How to Redirect a Python Console output to a QTextBox

a 夏天 提交于 2019-12-06 08:12:46
问题 I'm working on developing a GUI for the recompilation of Linux kernel. For this I need to implement 4-5 Linux commands from Python. I use Qt as GUI designer. I have successfully implemented the commands using os.system() call. But the output is obtained at the console. The real problem is the output of command is a listing that takes almost 20-25 min continuous printing. How we can transfer this console output to a text box designed in Qt. Can any one help me to implement the setSource()

Widgets are not shown in basic Qt application (QMainWindow)

独自空忆成欢 提交于 2019-12-06 07:08:15
问题 I am new to Qt and I am doing some practice with simple examples. I just wanted to test my knowledge with a simple application, by coding, in which user types a text in QLineEdit widget and the text will be shown in QLabel. There is no need for it to be useful. I just want to try. While compiling the application, I get no errors. However, QLabel and QLineEdit widgets are not visible when the window is opened. My codes are here: Window.h #ifndef WINDOW_H #define WINDOW_H #include <QMainWindow>

QVideoWidget: Video is cut off

白昼怎懂夜的黑 提交于 2019-12-06 04:34:17
I want to play a video in a Qt Application. This is my code so far: #include <QApplication> #include <QWidget> #include <QMediaPlayer> #include <QVideoWidget> #include <QUrl> #include <iostream> using namespace std; const int WIDTH = 1280; const int HEIGHT = 720; int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget window; window.resize(WIDTH, HEIGHT); window.setWindowTitle("Video Test"); window.show(); QMediaPlayer *player = new QMediaPlayer(); player->setMedia(QUrl::fromLocalFile("/Path/To/Video.mp4")); QVideoWidget *videoWidget = new QVideoWidget(&window); player-

screenshot of a qt application from inside the application

泪湿孤枕 提交于 2019-12-06 04:24:30
问题 I am trying to capture a screenshot of my application within the application. Its a Qt-based application. Is anyone aware of how to do this? Any suggestions are very welcome. CV 回答1: You can tell any QWidget (including your QMainWindow ) to render itself off-screen: http://developer.qt.nokia.com/doc/qt-4.8/qwidget.html#render Technically this is not a screenshot as it renders the widget explicitely for this purpose instead of capturing what is seen on-screen. For almost any purpose it doesn't