qt4.6

How can you edit a QTableView cell from a QTest unit test?

可紊 提交于 2020-12-29 06:51:30
问题 I'm writing a unit test for a custom Validator in a QTableView using the QTestLib framework. One of the most basic test cases could be described like this: Double click the table cell in the third column and the fourth row, and append the number '5' to its content. It is not sufficient to simply change the value in the model or anything, the test case shall perform it like this: Double Click the table cell to set it into edit mode Press the [End] key. Press the [5] key. Note: This question

How can you edit a QTableView cell from a QTest unit test?

╄→尐↘猪︶ㄣ 提交于 2020-12-29 06:50:09
问题 I'm writing a unit test for a custom Validator in a QTableView using the QTestLib framework. One of the most basic test cases could be described like this: Double click the table cell in the third column and the fourth row, and append the number '5' to its content. It is not sufficient to simply change the value in the model or anything, the test case shall perform it like this: Double Click the table cell to set it into edit mode Press the [End] key. Press the [5] key. Note: This question

how to center a Qt mainform on the screen?

这一生的挚爱 提交于 2020-02-26 17:44:11
问题 I've tried these in my mainform's constructor: QRect desktopRect = QApplication::desktop()->availableGeometry(this); move(desktopRect.center() - frameGeometry().center()); QRect desktopRect = QApplication::desktop()->availableGeometry(this); move(desktopRect.center() - rect().center()); but both put the bottom right corner of the form at about the center of the screen, instead of centering the form. Any ideas? 回答1: I've tried these in my mainform's constructor That's likely the problem. You

how to center a Qt mainform on the screen?

橙三吉。 提交于 2020-02-26 17:38:08
问题 I've tried these in my mainform's constructor: QRect desktopRect = QApplication::desktop()->availableGeometry(this); move(desktopRect.center() - frameGeometry().center()); QRect desktopRect = QApplication::desktop()->availableGeometry(this); move(desktopRect.center() - rect().center()); but both put the bottom right corner of the form at about the center of the screen, instead of centering the form. Any ideas? 回答1: I've tried these in my mainform's constructor That's likely the problem. You

how to center a Qt mainform on the screen?

自闭症网瘾萝莉.ら 提交于 2020-02-26 17:37:20
问题 I've tried these in my mainform's constructor: QRect desktopRect = QApplication::desktop()->availableGeometry(this); move(desktopRect.center() - frameGeometry().center()); QRect desktopRect = QApplication::desktop()->availableGeometry(this); move(desktopRect.center() - rect().center()); but both put the bottom right corner of the form at about the center of the screen, instead of centering the form. Any ideas? 回答1: I've tried these in my mainform's constructor That's likely the problem. You

How to work with OpenGL and QT?

筅森魡賤 提交于 2019-12-23 09:10:10
问题 I'm Working on a small project and i need to work with OpenGL + QT I'm Newbie in both of them. So i need a good tutorial that illustrates how to work with them each other not individually is it better to work OpenGL on QT Creator or use QT Visual Studio Plug-in? 回答1: You'll be using QGLWidget a lot! Here you go: http://doc.qt.io/qt-5/examples-widgets-opengl.html Of all those, maybe this is the best one to start: Hello GL Example. If you prefer using Qt Quick instead of Qt Widgets, check these

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

Where to control the QWizard button?

不想你离开。 提交于 2019-12-21 09:15:12
问题 I'm using Qt, and I use a QWizard object which contains several pages. when it comes to a specific page, I want to hide the "Next" button first, and shows it after the user do something (such as clicking on a radiobutton...) I want to do some customize control of the wizard when this specific page shows up. the question is, I know how to hide the button, but I don't know which function I should use. I tried the QWizardPage constructor, the initializePage function, the "show" function, but all

how to print a QGraphicsScene that has text and graphics

拥有回忆 提交于 2019-12-13 15:13:16
问题 I have a QGraphicsScene that has graphics as well as text drawn on it. When I try to print, the graphics are fine, but the text is using a font size defined in points, so scene->render() when I pass it a QPainter initialized with a QPrinter , has VERY large text. How am I supposed to print a QGraphicsScene that has text on it? edit: Here is my current printing code, where scene_ is my custom subclass of QGraphicsScene : QPrinter printer(QPrinter::HighResolution); QPrintDialog dialog(&printer,