qt

Border color of Qt components

霸气de小男生 提交于 2021-02-18 12:09:30
问题 I want to change border color of QFrame component. Also tried with style sheet but no effect at run time. In my project there are various Dialog UI are there which are basically QFrame and i want to change the border color of selected dialog i.e. QFrame border color. Is there any workaround for that in QT. As shown below there are two dialog when any one of selected it's respective frame border color should get changed 回答1: Try this: frame->setObjectName("myObject"); frame->setStyleSheet("

How to run OpenStreetMap offline in QML (Qt)

怎甘沉沦 提交于 2021-02-18 11:42:19
问题 I am using QML on Qt to display OpenStreetMap (using the osm plugin), which requires internet connection. Is there a way that I can do the same but running it offline? For example, running my own tile server (but how easy is that to do)? Or using a library that will let me do it quite quickly. By the way I am running my program on Ubuntu. Any help on how to do that and especially if someone can provide the steps to be done would be appreciated. Thank you. 回答1: I have managed to display

Qt: construct a mutable iterator for template (maps, lists, sets, …)

人盡茶涼 提交于 2021-02-18 11:29:45
问题 In my code I often have functions doing the same thing on different iterable Qt Container types, for instance: void removeX(QMap<qint64, QString> & map) { QMutableMapIterator<qint64, QString> it(map); while (it.hasNext()) { it.next(); if (it.value() == "X") it.remove(); } } void removeX(QList<QString> & list) { QMutableListIterator<QString> it(list); while (it.hasNext()) { it.next(); if (it.value() == "X") it.remove(); } } (and I know there is already a removeAll function in QList. This is

how to change Qt qListView Icon selection highlight

我只是一个虾纸丫 提交于 2021-02-18 11:17:06
问题 When using qlistview in icon mode I need to completely remove the hilighting when a icon is selected. Using the code below the text under the icon is no longer highlighted but I still get blue color over the icon when selected QString stylesheet = ""; stylesheet += "QListView::item:alternate {background-image: transparent; background-color: transparent;}"; stylesheet += "QListView::item:selected {background-image: transparent; background-color: transparent;padding: 0px;color: black;}";

TreeView in Python+QT

家住魔仙堡 提交于 2021-02-18 08:37:28
问题 I need to make a treeView with 4 columns with a checkbox in the first column. I have made ​​the tree view, just that I do not put the checkbox in the first column. I tried but it gets me in every position (row, column ) ........... Here is my code: import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from copy import deepcopy from cPickle import dumps, load, loads from cStringIO import StringIO class myNode(object): def __init__(self, name, state, description,otro, parent=None

QSplitter实现滑动窗口和悬浮按钮

好久不见. 提交于 2021-02-18 05:32:15
1 QSplitter实现滑动窗口和悬浮按钮 软件应用中需要设计右侧滑动窗口,通过一个按钮来实现窗口的隐藏和显示,应用场景比如显示主界面的详细信息。 (1) 在qt design 中添加QSplitter ,添加主窗口界面和右侧滑动窗口界面。 (2) 在程序中添加浮动按钮,并在初始化中设置按钮的属性 m_btnFold.setParent(this); m_btnFold.setFocusPolicy(Qt::NoFocus); m_btnFold.setFixedSize(16, 78);//设置大小 m_btnFold.setIconSize(m_btnFold.size()); m_btnFold.move(this->width() - m_btnFold.width(), (this->height() - m_btnFold.height()) / 2);//设置移动位置 m_btnFold.setStyleSheet("border:0px;border-style:outset;");//设置无边框 m_btnFold.setFlat(true);//设置扁平按钮 m_btnFold.setVisible(true);//设置可见 m_btnFold.setStyleSheet("background:url(:/qss/image/unfoldbtn.png)

QGraphicsView and eventFilter

有些话、适合烂在心里 提交于 2021-02-17 19:19:07
问题 This has been bugging me for more than two days now, so i thought i should ask. I am using Qt 4.5.3 (compiled with VC2008) on Win7. I have MyGraphicsView (inherits QGraphicsView) and MyFilter (inherits QObject) classes. When i install the MyFilter object as an event filter to MyGraphicsView, Mouse events are delivered to MyFilter after they are delivered to MyGraphicsView whereas Key events are delivered to MyFilter before they are delivered to MyGraphicsView. In the second case, i install

How to access QString value from one class (window UI) in another class?

孤人 提交于 2021-02-17 07:06:35
问题 I am about to program a small desktop application to capture the working times of my fellow co-workers. It must be customized to our needs, therefore a commercial solution is not an option (+ we have no money). I am using Qt (5.11.2) and C++. I have a MainWindow (first window UI) that uses auto-completion to get the information (ID, Names, Group Leaders, ...) from a sqlite3 database and fill the QLineEdits. This part is working just fine. Now, I have created a second window UI to capture the

How to get function to run at specyfic time using python and PyQt not using Cron

依然范特西╮ 提交于 2021-02-17 06:13:05
问题 I'm creating RSS app in PyQt and I'm trying to find a good way to program updates. I found this Executing periodic actions in Python but maybe there is Qt specific way to do this things. I know update period for each feed so I want to run update at specific time(hh:mm). Making 10 minute loop that will check current time and run a update if its grater than next predicted feed update seems missing the point of knowing specific time to run it. 回答1: You should use QTimer in Qt applications.

Set arguments with diffrent formats in QProcess

本秂侑毒 提交于 2021-02-17 05:50:22
问题 I want to run a python script in my qt project after clicking a pushButton using QProcess. This is my code : void MainWindow::on_pushButton_clicked() { QProcess p; QStringList params; QString pythonPath = "C:/Python/python.exe"; QString pythonScript = "C:\\Users\\melek\\Desktop\\user_interface\\user_interface-master\\match.py"; params << pythonScript; QStringList arguments; arguments <<"-t1"<<"start.png"<<"-t2"<< "end.png"<<"-i"<< "images_"; p.setArguments(arguments); p.start(pythonPath,