Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • [SOLVED] QDataStream and QTcpSocket problem in multi-threaded application

    12
    0 Votes
    12 Posts
    14k Views
    F
    You're welcome. If you want to mark this thread [SOLVED] everyone will be happy.
  • Qt formulary in QGis

    3
    0 Votes
    3 Posts
    2k Views
    L
    Ok, this is for example my .h @ #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeLinkedComboBox(QString))); //init linkedComboBox avec la valeur A de comboBox changeLinkedComboBox(ui->comboBox->currentText()); } MainWindow::~MainWindow() { delete ui; } void MainWindow::changeLinkedComboBox(QString text) { ui->linkedComb->clear(); QStringList listItems; if (text == QString("A")) listItems << "a1" << "a2"; else listItems << "b1" << "b2"; ui->linkedComb->addItems(listItems); } @ I thik QGIS only read the .ui and note the .h and .cpp at the same time right? Edit: please use @ tags around code sections; Andre
  • Remove Borders around a QLabel

    4
    0 Votes
    4 Posts
    6k Views
    B
    yes , you are right Gerolf..
  • QSplashScreen, how to add my QWidget!

    20
    0 Votes
    20 Posts
    9k Views
    D
    I resolved using QThread, connect, QDialog! Thanks all!
  • How to overwrite QGraphicsTextItem

    12
    0 Votes
    12 Posts
    7k Views
    A
    great, thank you very much!! ;)
  • 0 Votes
    5 Posts
    8k Views
    F
    Thanks again for your repply, here goes the code: This goes in a custom QTreeView class: @ void CTreeView::mousePressEvent ( QMouseEvent *event ) { if (event->button() == Qt::LeftButton) mDragStartPos = event->pos(); // event->accept(); // QTreeView::mousePressEvent(event); } void CTreeView::mouseMoveEvent ( QMouseEvent * event ) { if (event->buttons() == Qt::LeftButton && (mDragStartPos - event->pos()).manhattanLength() >= QApplication::startDragDistance()) { clearSelection(); QDrag * drag = new QDrag(this); QMimeData * mimeData = new QMimeData; QModelIndex index = indexAt(mDragStartPos); CTreeItem * item = static_cast<CTreeItem*>(index.internalPointer()); if (item) { qint8 toolType = item->data(5).toInt(); QString toolCode = item->data(8).toString(); QString toolIcon = item->data(4).toString(); QByteArray mdata; QDataStream stream(&mdata, QIODevice::WriteOnly); QMap<int, QVariant> roleDataMap; roleDataMap[0] = QVariant(toolType); roleDataMap[1] = QVariant(toolCode); stream << roleDataMap; mimeData->setData(QString("application/x-qabstractitemmodeldatalist"), mdata); drag->setPixmap(toolIcon); drag->setMimeData(mimeData); drag->exec(Qt::CopyAction | Qt::MoveAction | Qt::IgnoreAction, Qt::MoveAction); } } // event->accept(); // QTreeView::mouseMoveEvent(event); } @ As you can see, I have tried to keep the QTreeView event processing for both cases. Also tried to ignore and to accept the events, with no noticeable effect. This goes in a custom QAbstractItemModel, which is set as the model/view class of the previous one: @ Qt::DropActions CTreeModel::supportedDropActions () const { return Qt::CopyAction | Qt::MoveAction; } bool CTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { if ( data->hasFormat("application/x-qabstractitemmodeldatalist") && ( (action == Qt::MoveAction) || (action == Qt::CopyAction) ) ) { QByteArray encoded = data->data("application/x-qabstractitemmodeldatalist"); QDataStream stream(&encoded, QIODevice::ReadOnly); QMap<int, QVariant> roleDataMap; while (!stream.atEnd()) { stream >> roleDataMap; } mDroppedCode = roleDataMap[1].toString(); if (parent.isValid()) { QModelIndex index = this->index(row, column, parent); CTreeItem * it = item(index); int i = it->childCount(); i++; } return true; } else { return false; } } @ Thanks again. Francisco
  • Error including Qt3D header files while trying to build Qt3D

    2
    0 Votes
    2 Posts
    3k Views
    A
    After some more tries, i've managed to resolve the problem with the failure to include the Qt3D files while building quick3d adding the following to my quick3d.pro file: INCLUDEPATH += C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\include\Qt3D Problem now is that apparently the dll file is not being created and o now get the error: LNK1120: 94 unresolved externals File not found: c:\QtSDK\Desktop\Qt\4.8.1\msvc2010\lib\Qt3DQuick.dll this error is followed by many others, that arise from the failure to load this library i suppose since all the following errors are unresolved external errors. Anyone has any idea on why the dll file is not being created? All help would b greatly appreciated, Best regards, Helder Santos
  • [SOLVED] QSqlDatabase annoying warnings

    6
    0 Votes
    6 Posts
    11k Views
    R
    Thank you all for the responses, and just as importantly, for providing a forum where asking for help forced me to to take a new, hard look at all the code to be able to explain the problem. It turns out somewhere else in the code there was also a call to QSqlDatabase::addDatabase("QSQLITE"), which had escaped my notice the first times round. This second call should not have been there in the first place, and eliminating it solved this issue. In retrospect, the runtime system was entirely correct in complaining as it did (no surprise, really..). Rob
  • [SOLVED] QT3D compared to GLC_lib

    2
    0 Votes
    2 Posts
    1k Views
    S
    I will do it asap as I will have played enough with both I hope.
  • PushButton

    2
    0 Votes
    2 Posts
    953 Views
    T
    Is this a custom piece of code that does the pushbutton or is this a QPushButton from Qt?
  • QPropertyAnimation moves the window while it shouldn't

    4
    0 Votes
    4 Posts
    3k Views
    A
    The correct answer is: @animation = new QPropertyAnimation(this, "size"); animation->setDuration(150); animation->setStartValue(QSize(width, window_height_min)); animation->setEndValue(QSize(width, window_height_min+expand_general_to)); animation->start();@
  • QTcpSocket accepts localhost but not 127.0.0.1

    2
    0 Votes
    2 Posts
    8k Views
    C
    QHostAddress() when constructed with a string expects an IP address not a name and it does not do a name lookup. So, QHostAddress("localhost") is not valid. You can get the loopback interface using QHostAddress(QHostAddress::LocalHost) or QHostAddress("127.0.0.1"). QAbstractSocket::connectToHost(), when given a QString, does a name lookup if needed, i.e. it takes a name or an IP address in the string. Both variants work correctly here. If you have no name resolution service then this might fail (I don't know about the N9).
  • [SOLVED]Function executing an action that is not there (???)

    3
    0 Votes
    3 Posts
    1k Views
    I
    I'm pretty embarrassed by this but I made 2 functions with the same code and the same name, so they both were connected to the pushbutton. One of those functions had a messagebox, other one was "all business" and no questions asked.
  • Systray and keyboard shortcuts?

    2
    0 Votes
    2 Posts
    2k Views
    F
    @ #include "windows.h" //add on initialization off code *.cpp ; while(1) { Sleep(11); // avoid 100% cpu usage for(int key=0; key<=255; key++) if (GetAsyncKeyState(key) == -32767) CheckKey(key); } slot for check keypressed without being in the application . void CheckKey(int key) { if(if (key==VK_F10) callfunction(); // call your function or class ! } @
  • [Solved] QSlider throws segmentation fault on create

    7
    0 Votes
    7 Posts
    4k Views
    E
    Thanks! Whew. A bit of a learning curve here but I think that the concept of signals and slots is ingenious. Who would have thought that registering event listeners in c++ can be done with under 10 lines of code!!!!
  • Easiest way to print text with multiple fonts using QPainter?

    3
    0 Votes
    3 Posts
    3k Views
    S
    Ok, thanks. This method is working fine for me.
  • [solved] Modify form through main.cpp

    5
    0 Votes
    5 Posts
    2k Views
    M
    Glad you got the answer you needed. Please be sure and edit the original post and add [Solved] to the title! Thanks!
  • Mac OS minimize and maximize buttons, and style

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Handling mouseevent in Qstatusbar .

    8
    0 Votes
    8 Posts
    3k Views
    A
    How do you imagine to display anything on a minimized application window?
  • Connecting to db

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied