qt4

Is there a way to list current processes using Qt on windows?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 22:44:56
问题 Is it possible to know which processes are running using Qt 4? I'm looking for a way to wait until an application is closed by the user to make an operation. 回答1: I don't know a Qt solution either. But doing it is not that hard using the CreateToolhelp32Snapshot() , Process32FirstW() and Process32NextW() functions. Just search the MSDN for this. There is also a (IMO too complex) example on Taking a snapshot and viewing processes 回答2: Not really a Qt4 solution, but you could start WMIC in a

Polling a variable in QT once every second

不羁岁月 提交于 2019-12-23 19:26:15
问题 I'm working on a multithreaded image processing application. I added on a GUI based on QT for the purposes of changing some parameters that I have to experiment with a lot rather than loading them all from a settings file each time I start the program or having to type them in. I would also like the GUI to display some basic information from each of the threads so I can monitor them. I currently have thread safe methods of passing information between the image processing threads set up and I

How to get Duration of audio and video files in Qt without using QMediaPlayer

别等时光非礼了梦想. 提交于 2019-12-23 19:23:17
问题 I have been working on an application where I can traverse the system drives using QDirIterator and look for audio/video files, grab the details using QStandardItemModel and display it on QTreeview. I have been successful in displaying file name, type, size, date-modified but DURATION is something which I am not able to do. Here is the code: // Displays Files in Detail View on Clicking Drive void DetailView::on_DriveView_clicked(const QModelIndex &index) { int m_count_row = 0;

How to setup Qt Creator to work with CMake on Mac with Qt 4.7 SDK?

旧街凉风 提交于 2019-12-23 15:13:36
问题 I'm using Qt Creator 2.2.1 under MacOS X 10.6.8, standard MacOS X install for CMake 2.8.5 and Qt SDK version 1.1.2 released on June 21st (Qt 4.7.3 libraries). My CMakeLists.txt fails in the find_package for Qt4 -- the second of the lines below: set (CMAKE_MODULE_PATH /Applications/CMake 2.8-5.app/Contents/share/cmake-2.8/Modules) find_package (Qt4 REQUIRED HINTS /Users/myname/QtSDK) I added the first just to make sure it knew where FindQt4.cmake lives, but same error either with or without

How to set width of QTableView columns by model?

别说谁变了你拦得住时间么 提交于 2019-12-23 14:59:20
问题 I'm using QTableView with a subclass of QAbstractTableModel as its model. By implementing data() and headerdata() in the subclassed model, it is feasible to control many properties of the table like data, header values, font, and so on. In my case, I want the model to set the width of each table column. How can this be done? 回答1: There are two ways: In your model's data method you can return the role SizeHintRole. A better way would be to subclass QItemDelegate and override the method. See

Handling MouseEvents in Qt c++

吃可爱长大的小学妹 提交于 2019-12-23 13:24:08
问题 Sorry for my beginner's question... What is the easiest way to define procedures, which are executed when MousePressEvent or MouseReleaseEvent occurs? For now I am defining my own class (MyGraphicsView class), which inherits QGraphicsView and I am reimplementing mouse events (which are virtual functions). It works fine but is there any way to solve this problem without a need to define a new class? Can I connect Events with Slots somehow? Thanks for your help. 回答1: This thread on the Qt

how do I specify in qmake 4.5's .pro file that i want to ignore a library in msvc8 (2005)

社会主义新天地 提交于 2019-12-23 12:28:35
问题 I have a linking problem. It can be solved by specify in msvc8 project properties -> Linker -> Input -> Ignore Specific Library: msvcrtd.lib. That library conflicts with libcpmtd.lib. But can't find how to do the same thing in qmake's .pro file that is used to generate the .vcproj file. Grateful for any hint /LG 回答1: Write QMAKE_LFLAGS_DEBUG += /NODEFAULTLIB:libcpmtd in you .pro file. 来源: https://stackoverflow.com/questions/2682164/how-do-i-specify-in-qmake-4-5s-pro-file-that-i-want-to-ignore

Do I really need to call QFile::close() in this case?

你。 提交于 2019-12-23 12:26:01
问题 I'm not sure about QFile's behavior, bool Class::Function (const QString & name) { QFile fp (name); if (fp.open (QIODevice::ReadOnly)) { // read file return false; } return true; } Hmm, it's not like a FILE* pointer in C (which you must close and free), would this be a problem if I don't call QFile::close() (Does it do automatically on destruction) ? 回答1: Yes, it is closed automatically (Qt documentation), so there is no need to call close(). 回答2: I prefer calling fp.close() before the

How to nicely “cast” qint64 to int for QProgressBar

自作多情 提交于 2019-12-23 12:23:27
问题 I'm playing around with QFtp (yes .. I know) and all works well. Using code from their own example(s) as a guideline. http://doc.qt.io/archives/qt-4.7/network-qftp-ftpwindow-cpp.html The only problem I'm having is when sending (or receiving) big files (let's say 3 GB) the progress bar glitches out. This is due to the cast from qint64 to int in: void FtpWindow::updateDataTransferProgress(qint64 readBytes, qint64 totalBytes) { progressDialog->setMaximum(totalBytes); progressDialog->setValue

Qt Designer Shortcut to another tab

旧街凉风 提交于 2019-12-23 12:14:58
问题 I was wondering if it were possible to create my own shortcut key to a QTabWidget. So if I put an ampersand infront of the letter, that means that ALT+'letter' will display that tab; however, I want it so that CTRL+'letter' will display that tab (not ALT). Is there an easy way to do this in Qt Designer? If not, is there a simple way to do it in code? QTabWidget doesn't seem to have any direct methods for setting shortcuts. 回答1: I don't know of a way to do this via the Designer, not familiar