qtgui

Properly removing items from QGraphicsScene/QgraphicsItemGroup/QGraphicsView

。_饼干妹妹 提交于 2019-12-13 00:48:24
问题 I'm trying to make a plot with movable control points usig QGraphicsView , QGraphicsScene && QGraphicsItemGroup . The problem I've encountered is I can't find any method of removing/deleting the item. My thoughts are following: I'm going to have a QGraphicsView, on it are going to be movable interpolation points and under it a plot going through those points is going to be drawn. To achieve this I'm thinking of using two(or more) QGraphicsItemGroups . - one for interpolation points, which

Qt Splash Screen not showing

时光总嘲笑我的痴心妄想 提交于 2019-12-12 12:12:46
问题 I have this code, I want it to show a splash screen since it will be bigger, having had made a kind of timer so it is possible to see the splash screen working. The problem is I don't see the splash screen, but the code will be running while the splash screen doesn't appear, sending me directly to the main window without showing the splas screen. Here's my code. main.cpp #include <iostream> #include <QApplication> #include <quazip/quazip.h> #include "splashwindow.h" #include "mainwindow.h"

QT QSqlTableModel - background color in a given data column

你说的曾经没有我的故事 提交于 2019-12-11 19:31:40
问题 I have a tableView example: Like when the data column status is S. The background color of the table would be green and when N would be red. Example of what I want: My code: MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //Con Db... model = new QSqlTableModel(this); model->setTable("app"); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->select(); model->setHeaderData(0, Qt::Horizontal, tr("number")); model-

Python QtGui Calendar Widget Call button

一个人想着一个人 提交于 2019-12-11 11:39:09
问题 I am using a calendar widget for Python. And I need to call the widget when a button is clicked. The situation is that I cannot find what is the method in the calendar class that displays the widget itself. The calendar class was taken from here: http://www.eurion.net/python-snippets/snippet/Calendar_Date%20picker.html Here are my imports: from tkinter import * from tkinter import ttk import tkinter.messagebox import time import requests #needs to be installed import pymysql #needs to be

Passing a variable to other dialog Qt

本小妞迷上赌 提交于 2019-12-11 07:40:51
问题 I have a QTreeView with a list of text files. If a file is selected and void FileList_dialog::on_openButton_released() it should pass a variable path to dialog textFile_dialog . Until now I've this: void FileList::on_openButton_released() { QModelIndex index = ui->treeView->currentIndex(); QFileSystemModel *model = (QFileSystemModel*)ui->treeView->model(); QString path = model->filePath(index); QString name = model->fileName(index); QString dir = path; QFile file(path); qDebug() << path;

Child items not movable in QGraphicsView when ItemIsMovable flag is set

三世轮回 提交于 2019-12-10 18:18:18
问题 To resize items in a QGraphicsView, I'm putting child items representing vertices onto the item to be moved (using the parent-child relationship established in the constructor). Those are the four blue circles in the picture below: But the child vertices are not receiving mouse events. Only the parent item (red square) is getting mouse events. Here is the definition for Item : Item::Item(QGraphicsItem * parent) : QGraphicsItem(parent) { setFlag(ItemIsMovable); setFlag(ItemIsSelectable);

How to control the position of QDialog?

吃可爱长大的小学妹 提交于 2019-12-10 15:33:24
问题 Is there any easy way to open the Qt dialogs in the same position as they were the last time the application was open ? i.e. preserve position of dialogs between application sessions ? By easy way I mean not to have manually write the window position in file, and then read :) 回答1: You can use the QSettings class to achieve this. It's an abstraction class that allow your applications to store its settings in order to retrieve them at next launch. Save settings: QSettings settings("ValueName",

QImage from HBITMAP

☆樱花仙子☆ 提交于 2019-12-10 15:09:06
问题 In my windows-only program, I use a third-party library, which returns a HBITMAP . Is there a way to initialize a QImage from its contents, i.e. to convert it to a QImage ? 回答1: This is the way to do it for Qt 4 (QtGui): QImage image(QPixmap::fromWinHBITMAP(hBitmap).toImage()); This is the way to do it for Qt 5 (QtWinExtras): QPixmap pixmap = QtWin::fromHBITMAP(hBitmap); QImage image = pixmap.toImage(); // or QtWin::imageFromHBITMAP(hdc, hBitmap, width, height) 回答2: OK, this seems to work for

Qt Widget temporarily fullscreen

我只是一个虾纸丫 提交于 2019-12-10 14:07:26
问题 Consider a QWidget, normally a child in some Layout. Supposed I want to make it fullScreen for a while, then have it return to it's old spot. QWidget::setFullScreen() requires that the widget needs to be an independent window - any ideas how to work it out? 回答1: The simplest way I can see is to reparent to 0. Something like this: #include <QApplication> #include <QPushButton> class MyButton : public QPushButton { public: MyButton(QWidget* parent) : QPushButton(parent) {} void mousePressEvent

PyQt5 - Error import QtWidgets QtGui

不羁岁月 提交于 2019-12-10 10:57:20
问题 I'm running Ubuntu 13.10 (python-3.3.2+) . I've installed Qt5.2.1 (linux installer) , SIP 4.15.5 & PyQt5 both from source of the official site. PyQt5 build : The Qt qmake is located here jeby6372@mercure:~$ ls /opt/Qt/5.2.1/gcc_64/bin assistant qdbus qml1plugindump qmlviewer designer qdbuscpp2xml qml2puppet qtpaths lconvert qdbusviewer qmlbundle rcc linguist qdbusxml2cpp qmlimportscanner syncqt.pl lrelease qdoc qmlmin uic lupdate qhelpconverter qmlplugindump xmlpatterns moc qhelpgenerator