qt5

How to iterate through a QStandardItemModel completely?

こ雲淡風輕ζ 提交于 2020-01-14 09:32:12
问题 I have a QStandardItemModel, which I display in q QTreeView. Works fine. To highlight relevant rows I want to highlight some of them: Therefore I have a QStringList with the names of the QStandItem* s to be highlighted. QStringList namesToBeHighlighted = getNames(); QModelIndex in = myModel->index(0, 0); if ( in.isValid() ) { for (int curIndex = 0; curIndex < myModel->rowCount(in); ++curIndex) { QModelIndex si = myModel->index(curIndex, 0, in); QStandardItem *curItem = myModel->itemFromIndex

Why is my QT application not working?

梦想与她 提交于 2020-01-14 08:49:05
问题 I built a Qt 5 application using Qt Creator on Windows 7 64 bit (using msvc 2010). The application runs perfectly on my computer but it won't work on other computers. I copied all the .dlls which were shown as missing in Dependency Walker into the program folder and there is no error, but the application just won't run. I've tested it on Windows XP and Windows 7 64 and 32 bit. What can I do in order to find out what's wrong? UPDATE: i installed Qt 4.8.4 (vs 2008) and msvc 2008 express and i

Qt 5 : Mouse Wheel event behaviour for zooming image

浪尽此生 提交于 2020-01-14 03:05:16
问题 I have a window, in which is a QGraphicsView, which will be displaying an image. I have implemented the wheelEvent(). My images are mostly going to be bigger than the window, so I get scroll bars in the window. What we normally observe when we rotate the wheel while viewing an image in Windows Photo Viewer is that when we move the wheel up (towards it's wire), the image zooms in and when we move it down (towards out body), the image zooms out. What I am getting instead is when I move the

How to remove QTreeView indentation

拜拜、爱过 提交于 2020-01-13 16:27:25
问题 I want to have a QTreeView without an indentation on the left side increasing at each nesting level. I tried setting QTreeView::setIndentation(0) . It removes the indentations just as I want, however it also hides the tree arrows. Default behavior: With indentations ✗ With arrows ✔ After setIndentation(0) : Without indentations ✔ Without arrows ✗ Desired behavior: Without indentations ✔ With arrows ✔ So how can I achieve the result shown in the third example? Is there any standard way of

How to remove QTreeView indentation

帅比萌擦擦* 提交于 2020-01-13 16:27:18
问题 I want to have a QTreeView without an indentation on the left side increasing at each nesting level. I tried setting QTreeView::setIndentation(0) . It removes the indentations just as I want, however it also hides the tree arrows. Default behavior: With indentations ✗ With arrows ✔ After setIndentation(0) : Without indentations ✔ Without arrows ✗ Desired behavior: Without indentations ✔ With arrows ✔ So how can I achieve the result shown in the third example? Is there any standard way of

Replacing deprecated QtSignalMapper class to forward Signals in Qt5

你。 提交于 2020-01-13 07:28:49
问题 I have this code which makes a mdi window written for Qt 4: class MdiWindow : public QMainWindow { Q_OBJECT public: MdiWindow( QWidget *parent = nullptr) ... private: QWorkspace* workspace QSignalMapper* mapper } MdiWindow::MdiWindow( QWidget *parent ) : QMainWindow( parent ) { ... workspace = new QWorkspace; setCentralWidget( workspace ); connect( workspace, SIGNAL(windowActivated(QWidget *)), this, SLOT(enableActions())); mapper = new QSignalMapper( this ); connect( mapper, SIGNAL(mapped

初识Qt

﹥>﹥吖頭↗ 提交于 2020-01-12 21:12:23
初识Qt 本人硬件工程师一枚,在我开始想通过软件将公司的硬件电路设计标准化之前,我对Qt并不怎么了解,只知道她基于C++语言开发应用程序,然而我的C++也很烂,这也是我不去碰MFC框架而转战Qt的原因之一,当然这两者之间的优缺点对比不再细说;Google了一下Qt了解到的信息如下: Qt发展史 1991年Qt由Trolltech(奇趣科技公司)开发 2008年Nokia(诺基亚)收购了Trolltech,Qt自然成为诺基亚旗下编程语言 2012年Nokia将Qt业务及相关软件技术出售给了Digia(芬兰一家软件公司) 2013年之后,Digia成立了Qt开发团队细心培育Qt,2019年12月11日15点49分Digia发布Qt最新版本为 Qt5.14.0 Qt能做什么 Qt是一个跨平台的C++应用程序开发框架,用她可以轻易做出艺术级的图形界面;Qt 支持跨平台体现在她可以支持各大主流操作系统(Windows、Linux、Unix、嵌入式系统等);总的来说Qt用在各类桌面应用程序开发以及嵌入书系统应用程序开发上,比较典型的 案例 如Linux桌面环境KDE、WPS Office办公软件以及谷歌地图等 Qt商业版和开源版 Qt发行的版本分为Qt商业版和Qt开源版:商业版专门提供给商业软件开发使用,在商业有效期内会提供免费升级和相关技术支持服务;开源版开放Qt源码

Make qmake use qt5 by default

我是研究僧i 提交于 2020-01-12 07:35:09
问题 I have both qt4 and qt5 on my Linux system. qt4 is used by default. What is a clean way to change that so that qmake uses qmake-qt5 by default? 回答1: The system might have different meta packages that handle the default. For example on Debian there is a qt4-default and a qt5-default package, installing one of them will uninstall the other and set the symlinks appropriately 回答2: There is a tool named qtchooser to switch between Qt versions. On Debian and Ubuntu you can install it with apt-get

How to access ListView's current item from qml

狂风中的少年 提交于 2020-01-12 03:53:45
问题 I have an application that stores and edits notes. The list of notes is displayed in a listview like this: Page { id: noteList title: i18n.tr("QNote") visible: false Column { anchors.fill: parent ListView { anchors.fill: parent model: notes delegate: ListItem.Standard { text: Title onClicked: editNote(NoteText, Title, modelData); progression: true } } } } function editNote(text, title, item) { pageStack.push(noteEdit, {title: title, text: text}); handler.setActiveItem(item); } The notes item

QT insert widget inside an other widget

被刻印的时光 ゝ 提交于 2020-01-11 10:47:20
问题 I've created an UI with qt Creator,in this UI there is just a button and a widget (let's call it respectively button and char_container); I need to add a chartview programmatically inside the chart_container. I didn't change the default layout. I've tried the following code,but it does not work: void MainWindow::button_slot(){ QtCharts::QChart *chart = new QtCharts::QChart(); QtCharts::QChartView *chartView = new QtCharts::QChartView(chart); chartView->setParent(ui->chart_container); this