qt5

Qt 5.3. QtWidgets: No such file or directory #include <QtWidgets>

落爺英雄遲暮 提交于 2019-12-21 12:07:22
问题 I want to compile Qt example. I get error QtWidgets: No such file or directory #include greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - does not help QT += widgets - does not help INCLUDEPATH += /opt/Qt/5.3/Src/qtbase/include/ - does not help Qt 5.3. Ubuntu 14.04 x64. 回答1: You need to double check that you completed all these steps: Module installed greaterThan(QT_MAJOR_VERSION, 4): QT += widgets You re-run the Qt 5 qmake. Having said that, I would like to remind you that including the

QML TableView + QAbstractTableModel - how edit model data from QML?

雨燕双飞 提交于 2019-12-21 06:28:36
问题 I have C++ class inherited from QAbstractTableModel with next functions overriden: virtual QHash<int, QByteArray> roleNames() const noexcept override; virtual Qt::ItemFlags flags(const QModelIndex& index) const noexcept override; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const noexcept override; virtual int columnCount(const QModelIndex& parent = QModelIndex()) const noexcept override; virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const

Is MainWindow initialized with itself in qt5?

爷,独闯天下 提交于 2019-12-21 06:19:23
问题 I try to learn qt 5, but dont understand one thing. Qt creator makes these two files by default: mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) :

Qt 5 cannot deploy on SnowLeopard

泄露秘密 提交于 2019-12-21 04:50:49
问题 I have an issue where my app doesn't run on 10.6 Snow Leopard. I compile with these parameters: qmake LSPRO.pro -r -spec macx-clang CONFIG+=release CONFIG+=x86_64 in my Pro file, I have these elements: TEMPLATE = app HEADERS = \ mainwindow.h \ app_mediamanager.h \ api.h \ tool_htmleditor.h \ tool_videoencoder.h \ tool_thumbnaileditor.h SOURCES = \ main.cpp \ mainwindow.cpp \ app_mediamanager.cpp \ api.cpp \ tool_htmleditor.cpp \ tool_videoencoder.cpp \ tool_thumbnaileditor.cpp QT += network

Qt Color Picker Widget?

删除回忆录丶 提交于 2019-12-21 04:41:34
问题 I have a QDialog subclass that presents some options to the user for their selecting. One of these options is a color. I have seen the QColorDialog, and I need something much simpler, that is also a regular widget so I can add to my layout as part of my dialog. Does Qt offer anything like this or will I have to make my own? If the latter, what is the best strategy? 回答1: Have you looked at the QtColorPicker, part of Qt Solutions? QtColorPicker provides a small widget in the form of a QComboBox

What would be a pratical example of sysroot and prefix options for Qt

混江龙づ霸主 提交于 2019-12-21 03:43:24
问题 I'm looking at all the options that can be run for the configure script provided with Qt. (specifically qt-everywhere-opensource-src-5.2.0). After considerable searching, I've determined this stuff is poorly documented at best so I was hoping I could get some help. When I look at the descriptions for prefix and sysroot configuration options: ~/qt-everywhere-opensource-src-5.2.0$ ./configure -help | grep "sysroot" -extprefix <dir> ... When -sysroot is used, install everything to <dir> ,

QHttpMultiPart: post files to PHP script

风流意气都作罢 提交于 2019-12-21 02:41:42
问题 I am working in Qt 5 and struggling with a multipart upload. My script is as close to the docs as possible: QUrl testUrl("http://localhost/upload/test.php"); QNetworkRequest request(testUrl); QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); QString preview_path = "C:/preview.jpg"; QHttpPart previewPathPart; previewPathPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"preview_path\"")); previewPathPart.setBody(preview_path

Qt5 & QtQuick2 - transparent main window

♀尐吖头ヾ 提交于 2019-12-20 20:42:09
问题 I am trying to create a simple Qt UI with a frameless window and rounded corners. Starting from a new project with the QtQuick 2 Application template, my code looks like this: main.cpp #include <QtGui/QGuiApplication> #include "qtquick2applicationviewer.h" int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QtQuick2ApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("qml/qtquick-test/main.qml")); viewer.setFlags(Qt::FramelessWindowHint); viewer.showExpanded();

Rendering custom opengl in qt5's qtquick 2.0

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 12:35:43
问题 I'm looking for a way to render my custom opengl calls inside a qtquick 2.0 item. To give you some context: I have a C++ 3d engine that uses opengl for rendering. The goal is to have it rendering inside a qtquick 2.0 UI. What I found out is that pre qt 5.0 (qtquick 2.0) you would use a QtGlWidget and embed that into the QDeclarativeView. Another way I found would be to use a QtDeclarativeItem and override the void QDeclarativeItem::paint(QPainter *p, const QStyleOptionGraphicsItem *o, QWidget

Qt5 Syntax Highlighting in QML

佐手、 提交于 2019-12-20 11:49:50
问题 I am working on a QtQuick 2.0 presentation and I would like to embed some code samples. is it possible easily to create a syntax highlighting qml element. Can you give me example technologies and ideas on how to achieve it. Thanks 回答1: Qt Quick's TextEdit item exposes a textDocument property, of type QQuickTextDocument . This is explicitly exposed so you can use QSyntaxHighlighter directly with the document. QtQuick textEdit documentation for Qt 5.3 回答2: There is no obvious way to achieve