Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • 0 Votes
    11 Posts
    2k Views
    mranger90M
    Then you are going to have to tell us in great detail exactly what you are doing. You say that this all started when you removed a blank. From where ? The source code ? the pro file ? a .pri or .prf file ? For instance I don't understand what you mean by: "the test project can run well, but I overwrite the test project's pro and source file to my project, " So tell us what exactly happens in detailed step, like: Step 1. I open my project in QtCreator Version (xxx.yyy) Step 2. Project | Clean Step 3. Project | Run QMake Step 4. Project | Rebuild Step 5. Project Execute - Ok < Now I overwrite pro file ???> Step 6. File | Open Project ???? .... Step N: Project | Execute - Seg fault
  • Callback-Slot mechanism

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    M
    @kain said in Callback-Slot mechanism: This looks to me like some kind of workaround because I will probably need a several RequestCallback-objects. Or are there any better ideas? This makes me think of some sort of Notification Center. Some objects emit a notificarion and other objects register themselves to receive that notification. For example, with the preferences Dialog, when the user click OK, the prefDialog emits a PrefsDidChanged notification. Each windows or views that need to be informed of any changes register itself to receive that notification. I'm using custom events to emit this notification. EventCenter().addObserver(this, Event_AppPrefsDidChange); This line register 'this' to receive the AppPrefsDidChange notif. The notificationCenter post the event: QApplication::postEvent(o.observer,new CustomEvent(eventType,sender)); And in the receiver: void TextDocWindow::customEvent(QEvent* event) { CustomEvent* ev =static_cast<CustomEvent*>(event); switch (ev->subType()) { case Event_AppPrefsDidChange: Log("Prefs changed"); setupFromPrefs(); break; } } Here it's a text editor, the prefs changes can be color of text, size of font. etc. In the custom event object, you can pass any information you need to the receiver: class CustomEvent : public QEvent { public: CustomEvent(uint type,QObject* sender); virtual ~CustomEvent() { } QObject* sender() { return oSender; } uint subType() { return vSubType; } private: QObject* oSender; uint vSubType; }; It's possible to receive a type of notification from a particular object only. void addObserver(QObject *observer, uint eventType, QObject* sender=0); Here it is the sender extra parameter. Voilà, just an idea, hope it can help you.
  • Using QJson functionality to change data in nested json with arrays.

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    P
    Thanks! That helped big time!
  • QTableView Horizontalheader loop error.

    Unsolved
    4
    0 Votes
    4 Posts
    522 Views
    VRoninV
    I might be missing something but this looks like a bug in your code that can't manage the sizing once the scrollbars are shown. Doesn't sound like a problem in Qt
  • Enabling exceptions to Qt project in Visual Studio 2017

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    VRoninV
    @TheEnigmist said in Enabling exceptions to Qt project in Visual Studio 2017: Yes, I found out that Qt container suppose an index is alredy checked before accessing a list Not really: http://doc.qt.io/qt-5/qlist.html#value-1
  • SQL Server for Qt

    Solved
    2
    0 Votes
    2 Posts
    489 Views
    D
    Hi all, I was setting Driver name in wrong way. I've changed "SQL SERVER" to "ODBC Driver 17 for SQL Server" mDatabase.setDatabaseName("DRIVER={ODBC Driver 17 for SQL Server};" "Server=XXXX;" "Database=XXXXX;" "Uid=XXX;" "Port=1433;" "Pwd=XXXX;" "WSID=."); Works like a charm. Thanks all
  • Calling anonymous QML functions from C++

    3
    0 Votes
    3 Posts
    4k Views
    P
    Thank you for your answer. What if I want to call this function asynchronously? I tried to call this function asynchronously in C++, but it failed. Cheers
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • 0 Votes
    4 Posts
    3k Views
    VRoninV
    qt5_add_resources is obsolete. if you set(CMAKE_AUTORCC ON) just add your .qrc files as they were .cpp to add_library/add_executable moc needs the headers, make sure CMake can see them, usually you can use set(CMAKE_INCLUDE_CURRENT_DIR ON)
  • Building Qt 4.8.7 with Visual Studio 2017?

    Unsolved
    12
    0 Votes
    12 Posts
    13k Views
    jsulmJ
    @mic19 It should be nmake.exe not make when using VS
  • QLCDNumber blocked at 99999

    Solved
    3
    0 Votes
    3 Posts
    448 Views
    ODБOïO
    ah.. Thank you @J-Hilk
  • compare indexes of selected model and the model

    Solved
    3
    0 Votes
    3 Posts
    487 Views
    U
    @JonB it didn't work for me :( EDIT: i used isRowSelected() and that worked
  • when i write text on QLineEdit that text shows on QLabel

    Solved
    20
    0 Votes
    20 Posts
    4k Views
    D
    @mrjj thanks for ur reply & thank u all ,,, i changed two lines of code,,,now whatever i text ,,that is showing first ,,,this is i wanted anyway thanku all for ur reply ,,i got output wat i wanted! Mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_add_clicked() { QString text=ui->lineEdit->text(); QListWidgetItem * item = new QListWidgetItem(text); item->setFlags(item->flags() | Qt::ItemIsEditable); int row = ui->listWidget->row(ui->listWidget->currentItem()); ui->listWidget->insertItem(row, item); ui->lineEdit->clear(); } void MainWindow::on_delete_2_clicked() { delete ui->listWidget->currentItem(); } Ui Page [image: a6cfc9ed-cfe6-4fac-9166-877158759726.PNG]
  • Signal for QSerialPort is not shown on list...

    Solved
    8
    0 Votes
    8 Posts
    812 Views
    B
    @bladekel I found it.... Here is the new syntax... connect(&arduino,&QIODevice::readyRead,this,&MainWindow::serial_received);
  • LINK 1104 Error

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    L
    @jsulm your method works, thanks.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    13 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    27 Views
    No one has replied
  • Qt Embedded: displaying on two screens using QGraphicsView and QGraphicsWidget

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    SGaistS
    I mean what backend are you using ? If not QWS, do you have an Xorg server running on your device ?
  • Qt setStyleSheet background-image crash on ubuntu 18.04

    Unsolved
    4
    1 Votes
    4 Posts
    763 Views
    SGaistS
    Can you provide a minimal compilable example that shows the behaviour ?
  • Qt QLocalServer Message Mode Support

    Solved
    2
    0 Votes
    2 Posts
    359 Views
    SGaistS
    Hi, From the looks of it, you would have to rebuild Qt yourself.