Category Archives: Qt-Tips

Removing MinGW dll dependencies in QT Static linking

libgcc_s_dw2-1.dll Passing -static-libgcc will remove this dependency for all languages other than C. Note: C++ exceptions depends on this option. mingwm10.dll Remove -mthreads option from your makefile. Note: Multithreading and C++ exceptions depends on this option.

Posted in Qt, Qt-Tips Tagged , , ,

Use QColor from getColor on QLabel and QTextbox

//To use color on text and label //Simple sample :) QColor color = QColorDialog::getColor(QColor(ui->backgroundColorPickerText->text()), this); if(color.isValid()) {   QPixmap pix(21, 21); pix.fill(color);   ui->backgroundColorPickerLabel->setPixmap(pix); ui->backgroundColorPickerText->setText(color.name()); }

Posted in Qt, Qt-Tips Tagged , , ,

create a custom dialog box with multi line input in qt

//create a custom dialog box with multi line input void MainWindow::createMultilineInput() { //class variable dlgMultiLine = new QDialog(this);   //local variable QGridLayout *gridLayout = new QGridLayout(dlgMultiLine);   //class variable txtMultiline = new QPlainTextEdit();   txtMultiline->setObjectName(QString::fromUtf8("txtMultiline")); gridLayout->addWidget(txtMultiline, 0, 0, 1, 1); … Continue reading

Posted in Qt, Qt-Tips Tagged , ,

show data in external window with custom widget in qt

Sometime you need to show data in external window with custom widget(s). This little code will help you. function showCustomWidget() {   QDialog *dlgMultiLine = new QDialog(); QGridLayout *gridLayout = new QGridLayout(dlgMultiLine); QPlainTextEdit *txtMultiline = new QPlainTextEdit();   txtMultiline->setPlainText(this->toPlainText());   … Continue reading

Posted in Qt, Qt-Tips Tagged , , ,

getting all files from subdirectories recursively with c using qt framework/

// Display a dialog to the user to choose his music directory QString directory_path = QFileDialog::getExistingDirectory(this, tr("Select your music directory"), QDir::currentPath());   // Then create an instance of our QDirIterator, which takes as parameters // the directory, a QDir filter … Continue reading

Posted in Qt, Qt-Tips

Create single instance application in Qt 4 : Qt Tip #1

Many times we want only single instance of application. How can we achieve this. I’m going to show a simple way to achieve this. We need a Utility that is freely provided by Qt guys . Click here to know … Continue reading

Posted in Featured, Qt, Qt-Tips Tagged , , ,