qt4.8

Make QHorizontalLayout expand inside QFrame

谁说胖子不能爱 提交于 2019-12-11 11:18:22
问题 I have a widget hierarchy like this, with a frame (in order to set a background color behind the buttons and label) and a horizontal layout as its direct child. However, the horizontal layout (red frame in below screenshot of Qt Designer) does not take up the whole space inside the frame. How can I do that? Changing the property "layoutSizeConstraint" does not work. The label is already set to "Expanding" in horizontal direction, but still it keeps its size – I can resize the horizontal

How to create Web History for my Browser

笑着哭i 提交于 2019-12-11 07:27:02
问题 I'm new to Qt. I am Trying to create a Sample Browser Application. I had created the Browser application. Now i need to create the Web history for my application. I don't know how to do it. can anyone please help me with this. Thanks in advance. 回答1: QWebHistory * QWebView::history () The Arora Browser is based in the QWebView... as mentioned here. This browser is the foundation for the Arora Browser, a simple cross-platform Web browser. I would look at how they implemented their history. In

Add icon from array to QListWidget item

这一生的挚爱 提交于 2019-12-11 06:56:39
问题 I've written a loop which adds some items to my QListWidget . Now I want them to have an icon from my qrc file. For this I would use a loop in which I add a unique icon to each item. void Test::Query() { ui->listWidget_Available->clear(); QString CmdList[4] = {"kcmshell4 --list|grep -q kcm_grub2", "kcmshell4 --list|grep -q kcm_networkmanagement", "which pastebunz", "[ -z $ink3_ver ]"}; QString NameList[4] = {"kcm_grub2", "kcm_networkmanagement", "pastebunz", "Shellmenu"}; QString IconList[4]

QFileDialog : how to set option to show content of folder in getExistingDirectory()

不羁的心 提交于 2019-12-11 01:29:51
问题 I am using QFileDialog as filename = QFileDialog::getExistingDirectory(this,"Select Image File: ",dataDir,0); I want that I can check files inside folder before selecting it. function getExistingDirectory() is setting QFileDialog::ShowDirsOnly as a default option. I checked in docs there is no any option that do opposite of this. So I set last parameter 0. But now it is not using native dialog. I want to use native dialog with this. I have no clue how to do this cause no flag found in options

How to Move Up a Selected Row in Qt

╄→гoц情女王★ 提交于 2019-12-10 18:54:22
问题 I have a QTableView with 3 rows and 2 columns. (Here I am using a QStandardItemModel ). I want to move up/move down a single row when a QPushButton is clicked. How can I move up/down a row in QTableView ? Thanks for your reply vahancho. I have already tried using QAbstractItemModel::moveRow , but it doesn't work: int currentRow = ui->tableView->currentIndex().row(); QModelIndex sourceParent = ui->tableView->model()->index(ui->tableView->selectionModel()->currentIndex().row(),0); QModelIndex

Qt 5 encoding problems (UTF-8, Windows-1250, Windows-1251)

≯℡__Kan透↙ 提交于 2019-12-10 10:36:44
问题 All my source file are UTF-8 converted. All my files Im opening are UTF-8. My application is opening UTF-8 coded file which contains translated text for 3 languages: English, Polish and Russian and is saving the data to a file into 3 separate encoded blocks: Windows-1250 (English), Windows-1250 (Polish) and Windows-1251 (Russian) - yes that's right Im mixing encoding type inside one file which is then used by third-party device which know how to handle that. Iv got a test program which worked

QListWidgetItem with Radio Button

让人想犯罪 __ 提交于 2019-12-07 14:26:44
问题 I'm working on my first QT application and I have a problem with QListWidgetItems . I will be having different kind of list. for checkboxed list using: listElement[i]->setFlags(Qt::ItemIsEnabled); listElement[i]->setCheckState(Qt::Unchecked); works exactly as wanted. But now I want a Radio Button list. so my question is in two parts can use the same logic that I used for checkBox to create Radio Buttons? I have used: listElement[i]->setFlags(Qt::ItemIsEnabled); QRadioButton *radio1 = new

Difference in relative file path: debug mode and release mode of Qt Creator

别说谁变了你拦得住时间么 提交于 2019-12-07 14:07:41
问题 QFile file("test.txt"); if (file.open(QIODevice::ReadOnly)) { qDebug()<<"You got me."; } I am using: Qt 4.8.6 with MSVC 2010 Qt Creator 3.1.1 Windows 7 (32 bit) From the above code, if .pro file has not been changed , the corresponding build directory for the debug mode : D:\...\build-Main-MSVC2010-Debug and the .exe of the debug mode will be located in D:\...\build-Main-MSVC2010-Debug\debug for the release mode : D:\...\build-Main-MSVC2010-Release and the .exe of the release mode will be

QApplication segmentation fault

风格不统一 提交于 2019-12-07 07:56:55
问题 I get a crash when try to create a QApplication object. This is my code: #include <QLabel> #include <QApplication> int main(int argc, char* argv[]) { QApplication app(argc, argv); return app.exec(); } I am using Qt version 4.8.4 and the MinGW compiler. My application crashes when running QCoreApplicationPrivate::processCommandLineArguments method. Can anybody tell how to solve this problem? 回答1: Apparently, this error is caused by binary incompatibility of Qt binaries and your compiler. From

Stacking QPushButtons on the other side of a QMenuBar

梦想与她 提交于 2019-12-07 05:54:05
问题 I want to stack some QPushButton objects on the other side of my QMenuBar . This is how my window looks now: And this is how I want it to look like (I've photoshopped the image): I know that in the motif widget style, the help menu is aligned to the right, but I'm sticking with plastique , so it's not a problem for me. I'm using Qt4.8. Any ideas? 回答1: QMenuBar has a setCornerWidget function, that sets a widget (that may include a whole layout) as the cornet widget. 回答2: QMainWindow: