qt

Reducing WAV sound file size, without losing quality

耗尽温柔 提交于 2021-02-19 05:32:44
问题 My application needs to play sound files. The only cross-platform file format I can use is WAVE (I'm using QSound of the Qt framework). The file sizes of these sounds are quite large and I'd like to know if there is a way to reduce it, without losing (too much) quality. I need the file to be stereo. 回答1: You can zip them (using zlib or similar), then uncompress them on demand. If you've got many minutes of continuous wav it may be worth looking into audio-specific lossless compression

QT missing dll after deploy

霸气de小男生 提交于 2021-02-19 04:41:27
问题 I've copied all of the dlls from QT that were required, and my application works fine on my Windows server machine. However when trying to run it on a Windows 7 box i get the following message: This application failed to start because it could not find or load he Qt platform plugin "windows". Reinstallning the application may fix this problem. Any ideas what I'm missing here? 回答1: I'd scratched my head over this some time ago. It turned out that this was caused not by missing qwindows.dll ,

Set a StyleSheet for a whole widget in Qt

冷暖自知 提交于 2021-02-19 03:58:05
问题 I have a custom widget which inherits from QWidget and contains some labels in its layout. I would like to change the background color of the widget and the labels in the widget (this is, everything!) every time I put the mouse over it. When using *:hover { background: red; } in my custom widget, I only get the contents red when moving the mouse over the labels, but not outside them, between labels, etc. I don't understand this behavior taking into account that I put the StyleSheet in the

QComboBox: Only show the icons when expanded

ぐ巨炮叔叔 提交于 2021-02-19 03:09:23
问题 Starting from a "normal" QCombobox I'd like to get a QCombobox that only shows the icon when it's expanded, but not when it's collapsed. I've found several answers to similar questions, but all of them show code for much more complex situations and I have not managed to distill the core of it. There are two approaches I've seen: attaching a QListView or using a QItemDelegate (or both). But I could not find any sample code that is straight to the point. This is my starting point: MainWindow:

QComboBox: Only show the icons when expanded

試著忘記壹切 提交于 2021-02-19 03:08:06
问题 Starting from a "normal" QCombobox I'd like to get a QCombobox that only shows the icon when it's expanded, but not when it's collapsed. I've found several answers to similar questions, but all of them show code for much more complex situations and I have not managed to distill the core of it. There are two approaches I've seen: attaching a QListView or using a QItemDelegate (or both). But I could not find any sample code that is straight to the point. This is my starting point: MainWindow:

QComboBox: Only show the icons when expanded

二次信任 提交于 2021-02-19 03:07:49
问题 Starting from a "normal" QCombobox I'd like to get a QCombobox that only shows the icon when it's expanded, but not when it's collapsed. I've found several answers to similar questions, but all of them show code for much more complex situations and I have not managed to distill the core of it. There are two approaches I've seen: attaching a QListView or using a QItemDelegate (or both). But I could not find any sample code that is straight to the point. This is my starting point: MainWindow:

Simple way to get all visible items in the QListView

青春壹個敷衍的年華 提交于 2021-02-19 02:52:49
问题 I am trying to develop an image gallery application using Qt Framework. The application loads all the images from the selected folder and those images are displayed using QListView control. But now i want to reduce the memory consumption by loading only the images that are visible to user. Since there is no direct function to get all the visible items in the view, i am not able to achieve this. 回答1: You can get the visible items of a list view using the indexAt function. For more details and

swig: How to make a QList<T> iterable, like std::vector

拈花ヽ惹草 提交于 2021-02-19 02:39:10
问题 I'm using SWIG to generate Python Bindings for my qt app. I have several places where I use QLists and I would like to integrate those QLists like std::vector from the SWIG Library (see http://www.swig.org/Doc1.3/Library.html#Library_nn15). This means: The QList objects should be iterable from python (= they must be an iterable python object) It should be possible to pass a python list to a function which takes a qlist ... and all the other features listed in the SWIG Library for std::vector

Run a Qt app in a different language?

為{幸葍}努か 提交于 2021-02-19 02:18:12
问题 I'm working on a Qt application that used to be a KDE application. In the old days, I just had to use some syntax like: KDELANG=de ./my_app That ran my_app in German, and only my_app. It might not have been KDELANG, but it was some environment variable like that. I've spent a ridiculous amount of time trying to coax this answer out of Google, and I give up. There must be some way to run a Qt (4.5 if that matters) application in some other language without switching over my entire locale to

Run a Qt app in a different language?

▼魔方 西西 提交于 2021-02-19 02:18:03
问题 I'm working on a Qt application that used to be a KDE application. In the old days, I just had to use some syntax like: KDELANG=de ./my_app That ran my_app in German, and only my_app. It might not have been KDELANG, but it was some environment variable like that. I've spent a ridiculous amount of time trying to coax this answer out of Google, and I give up. There must be some way to run a Qt (4.5 if that matters) application in some other language without switching over my entire locale to