qt4

Getting font metrics without GUI (console mode)

血红的双手。 提交于 2020-08-27 04:19:37
问题 Let's say some images have to be generated by a Qt console program and that font metrics are needed by internal algorithms (they use the text width/height as input to compute the position where the drawing should occur). This program has to be runable on a Linux without any GUI (runlevel-3, basically a cluster without any display server). Problem: QFontMetrics are only available when running a Qt application in GUI mode. Any workaround to get string metrics without any display server ? 回答1:

Qt resources files with CMake and AUTORCC

流过昼夜 提交于 2020-08-21 06:05:33
问题 Solution : Add resource files in the add_executable() statement Problem (not in the add_library() ) Fail to set main window icon. Notes : When I don't use AUTORCC I run into some compilation problems: QtCore/qglobal.h: no such file or directory . But, I do prefer AUTORCC as a more modern CMake approach. Without the AUTORCC (different CMakeLists.txt than the provided) and Qt-4.6.2 the current code worked. different CMakeLists.txt) Code This is a minimized code of my project. Tree: |-

QtDesigner for Raspberry Pi

≡放荡痞女 提交于 2020-08-09 07:05:48
问题 I am building a UI with QT Designer. I need this UI to run on a Raspberry Pi. What do I need to do to make the UI for the Pi? Does it have to be written in a specific language like python or can I just write it in whatever and launch it on the Pi? I am new to this and would really appreciate the guidance. 回答1: To run qt-creator on Rpi itself. You can install it by "sudo apt-get install qt-creator" It will install qt-creator and qt4-base modules on rpi. After installing, you can run "qt

QtDesigner for Raspberry Pi

杀马特。学长 韩版系。学妹 提交于 2020-08-09 07:05:20
问题 I am building a UI with QT Designer. I need this UI to run on a Raspberry Pi. What do I need to do to make the UI for the Pi? Does it have to be written in a specific language like python or can I just write it in whatever and launch it on the Pi? I am new to this and would really appreciate the guidance. 回答1: To run qt-creator on Rpi itself. You can install it by "sudo apt-get install qt-creator" It will install qt-creator and qt4-base modules on rpi. After installing, you can run "qt

Display the input of QLineEdit in a different window and or dialog?

岁酱吖の 提交于 2020-08-02 05:27:09
问题 I am writing a small QT gui application where there is a QLineEdit in my mainwindow.ui and I want to display the entered text in a separate dialog and or window when a button is pressed. Now, I have stored the input in a variable, and I am also able to show this string on a label within this same mainwindow, void MainWindow::on_GoButton_clicked() { QString mytext = ui->lineEdit_1->text(); ui->label_1->setText(mytext); } Now, I want to open a popup dialog (can be a window also), for example

How to install a custom widget in Qt?

Deadly 提交于 2020-06-27 18:46:09
问题 I have extended QListView to override its mouse events, and I wish to make that extension available as a widget on the Qt Creator visual design Widget Box. I am following the analog clock example of building a custom widget. I managed to build it without errors. But how do I install it? Do I add a build step and append "install" to the make command? The Qt docs merely mention, like, oh you could install just it or make install, without clearly explaining how to install a custom widget. How do

QSplitter becoming undistinguishable between QWidget and QTabWidget

故事扮演 提交于 2020-06-24 06:16:29
问题 I am puting a QWidget and a QTabWidget next to each other in one horisontal splitter. And the splitter loses it's shape, you can know that there is a splitter only by hovering mouse on it. How to make it visible? Thanks. 回答1: Since the QSplitterHandle (which is what most people think of as the 'splitter') is derived from QWidget, you can add other widgets to it. Here is what I have done to solve this exact problem in the past: // Now add the line to the splitter handle // Note: index 0 handle

QLabel not giving updated txt

混江龙づ霸主 提交于 2020-06-23 18:04:10
问题 I added a QLabel inside my widget and it is editable through UI, able to set new text also, but not able to retrieve the updated text using function text(); QLabel *m_ColorName = new QLabel("_________"); m_ColorName->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextEditable); In UI i am able to edit to new text but by calling function m_ColorName->text(); Its giving default txt _________ Code H file class CascadeColorHighlightWidgetItem : public QWidget { Q_OBJECT public:

QML animations visible property changes

无人久伴 提交于 2020-05-25 06:24:06
问题 I want an animation to be painted when an element becomes visible (is should appear smoothly, not the whole at all) I tried this states: State { name: "iconOff" when: iconOnSwitch.checked == false PropertyChanges { target: selectIconRow; visible: false } } transitions: Transition { reversible: true from: "" to: "iconOff" PropertyAnimation { properties: "x,y,visible" easing.type: Easing.InOutQuad from: selectIconRow property: "visible" } } But the selectIconRow still appears immediately How