qt4

Qmake does not support build directories below the source directory

半世苍凉 提交于 2019-12-23 06:49:10
问题 I have created an application that compiles and runs like a charm on OS-X. I would now like to start getting it to work on Windows. To start, I copied the project to a windows machine and just tried to compile, but got this error: :: warning: Qmake does not support build directories below the source directory. Any ideas? 回答1: Don't copy your project.pro.user file when you are copying a project from one machine to another, or from one directory to another. When you open the project, Qt Creator

Fails to display mp3 files in TreeView in Qt

烂漫一生 提交于 2019-12-23 06:07:53
问题 Alright I seem to have come across a situation where I need to traverse my directories and search for only .mp3 and .mpeg files. Once searched, I want to display them in my tree view. Basically I have 2 tree views in my app, one displays the system directories and other should display only .mp3 and .mpeg files. Here is the code // Gets called when application starts void DetailView::onCamStartup() { m_SystemModel = new QFileSystemModel(this); m_SystemListViewModel = new QFileSystemModel(this)

QLineEdit Focus Event

此生再无相见时 提交于 2019-12-23 05:27:21
问题 I have two widget mainwindow123 and second-class. In my MainWidget.cpp have one lineedit and button field. Initially I can set the focus on the line edit. But after come from the second.cpp Widget then I could not set the focus on the lineedit. Please help me.. Which place I did the mistake? Thanks in advance. This is my code MainWidget.cpp MainWidget::MainWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MainWidget) { ui->setupUi(this); s = new second(); connect(ui->pushButton, SIGNAL

Objects seems to be deleted if not assigned to object variable in PySide

大兔子大兔子 提交于 2019-12-23 03:04:24
问题 I'm trying to use QStandardItemModel to represent a hierarchy of data, but when I'm adding QStandardItems to the model, I have to assign them in object member variables, or the objects seems to be deleted. For example self.tree_model = QStandardItemModel() self.tree_model.setHorizontalHeaderLabels(['Category']) self.out_insertions = QStandardItem("Insertions") self.tree_model.invisibleRootItem().appendRow(self.out_insertions) Works as expected (an "Insertion" row is inserted under the column

undefined reference to `_imp___ZN10HTTPClient5abortEv' and others

烈酒焚心 提交于 2019-12-23 02:32:07
问题 I am migrating a huge project from Qt 4.x to 5, I am almost finished but Im having errors that I cannot locate, I think it has to do with the linkage of some libraries but I am somewhat lost here. I hope someone can throw some light on this matter. Errors: ./release\addeditaton.o:addeditaton.cpp:(.text+0x6ac2): undefined reference to `_imp___ZN10HTTPClient5abortEv' ./release\addeditaton.o:addeditaton.cpp:(.text+0x98c5): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb' ./release

Cannot read output using readyReadStandardOutput in Qt

好久不见. 提交于 2019-12-23 01:34:07
问题 I am using Qt and I am unable to get output of a exe file using readyReadStandardOutput. Here is my code. mainwindow.cpp void MainWindow::on_pushButton_24_clicked() { myprocess = new QProcess(this); myprocess->start("files\\helloworld.exe"); connect(myprocess, SIGNAL(readyReadStandardOutput ()), this, SLOT(outlog())); } void MainWindow::outlog() { QString abc; abc = myprocess->readAllStandardOutput(); emit outlogtext(abc); ui->lineEdit_4->setText(abc); } mainwindow.h #ifndef MAINWINDOW_H

how to use Qt setWindowFilePath

不羁岁月 提交于 2019-12-23 01:12:24
问题 I can't seem to get setWindowFilePath to work in any of my projects. The value is stored and can be retrieved, but it never shows up in the title bar of my app. It does work correctly in a sample app I downloaded, but I can't find what they do differently. Anyway, here's a simple app I created to demonstrate the problem. I pasted the code from the 3 files, mainwin.h, main.cpp, and mainwin.cpp below. Any ideas? I'm using Qt 4.6.3 on Windows 7, with the MS compiler. #ifndef MAINWIN_H #define

how to use Qt setWindowFilePath

偶尔善良 提交于 2019-12-23 01:12:17
问题 I can't seem to get setWindowFilePath to work in any of my projects. The value is stored and can be retrieved, but it never shows up in the title bar of my app. It does work correctly in a sample app I downloaded, but I can't find what they do differently. Anyway, here's a simple app I created to demonstrate the problem. I pasted the code from the 3 files, mainwin.h, main.cpp, and mainwin.cpp below. Any ideas? I'm using Qt 4.6.3 on Windows 7, with the MS compiler. #ifndef MAINWIN_H #define

Qt seconds to DD HH SS

拜拜、爱过 提交于 2019-12-22 20:00:11
问题 using Qt 4.8 how can I print the time in the format DD HH SS? I have the seconds and I want to get back a string in that format. 回答1: QDateTime::fromTime_t(seconds).toString("ss hh DD"); see http://qt-project.org/doc/qt-5.0/qdatetime.html#toString If you want a duration ( your question was really unclear) try something like : QString seconds_to_DHMS(quint32 duration) { QString res; int seconds = (int) (duration % 60); duration /= 60; int minutes = (int) (duration % 60); duration /= 60; int

How to get Qt 4/5 to build using VS2012 while targeting Windows XP?

99封情书 提交于 2019-12-22 15:52:25
问题 I'm trying to build Qt 4.8.5 / Qt 5.2.1 using Visual Studio 2012, targeting Windows XP (SDK v7.1a). There are various incompatibilities of the source with SDK v7.1a while compiled with VS2102, so it doesn't work out of the box. This is to be a canonical question that provides the knowledge necessary to successfully build Qt in such an environment. 回答1: First of all, the build environment needs to be prepared as below. Caveat emptor: There are variants of this script "out there" that have