Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • QDateTimeAxis - how to set format of date the same as system has, but without time?

    Unsolved
    2
    0 Votes
    2 Posts
    223 Views
    artwawA
    @CuriousPan said in QDateTimeAxis - how to set format of date the same as system has, but without time?: QDateTimeAxis Should you feel brave and actually spend 30 seconds looking into the documentation, like I did, you would notice that there is a setFormat() method: https://doc.qt.io/qt-5/qdatetimeaxis.html#format-prop And that it takes well known format strings from QDateTime: https://doc.qt.io/qt-5/qdatetime.html#toString
  • How to draw with vertices, circle (and other shapes) ?

    Solved 2d graphics painter
    6
    0 Votes
    6 Posts
    943 Views
    timob256T
    @ mrjj why can't I get a full circle ??? #include "krug_qt.h" Krug_qt::Krug_qt(QWidget *parent) : QMainWindow(parent) { R = 90.0; q = 24; p = 24; kol_toch = 180; } Krug_qt::~Krug_qt() { } void Krug_qt::fillVertexArray() { float grad = 360.0/kol_toch; float grad_kol_toch = 0.0; // градусы*M_PI/180 = радианы int j; for (j = 0; j <= kol_toch; ++j){ integerVector.append(R * cos(grad_kol_toch*M_PI/180.0)); integerVector.append(R * sin(grad_kol_toch*M_PI/180.0)); grad_kol_toch = grad_kol_toch + grad; } } void Krug_qt::paintEvent(QPaintEvent *event) { integerVector.clear(); QPainter painter(this); // Создаём объект отрисовщика QPen pen_abris(Qt::black, 2, Qt::SolidLine, Qt::FlatCap); // кисть обрисовки (компаса) painter.setRenderHint(QPainter::Antialiasing); // убираем резкие кубики painter.setPen(pen_abris); // Устанавливаем кисть обрисовки fillVertexArray(); // Набираем массив painter.translate(this->width()/2, this->height()/2); // смещение отрисовки qDebug() << integerVector.size(); int f = 0; for(int i =0; i<integerVector.size()/2; i++) { i++; f++; painter.drawPoint(QPointF(integerVector[--i],integerVector[i])); qDebug() << "f :"<<f; // painter.drawPoint(QPointF(integerVector[i],integerVector[i++])); // i++; } } [image: b782ea31-6cc8-4d5e-815c-3a70041efd3d.png]
  • Passing slot as parameter in function to connect to a signal

    Solved
    7
    0 Votes
    7 Posts
    558 Views
    J
    I have decided to change my funtion. QWidget* addPushButtonInTableCell(U2bYTES row, U2bYTES column, U2bYTES numberToPushButton, QTableWidget * pTableWidget , QWidget* parent, QString ruta, const char* slot) { QWidget *pWidget = new QPushButton(QString::number(numberToPushButton),parent); ... return pWidget; } Invoke QWidget* pWidget = addPushButtonInTableCell(0,15,pQ->u.cue.n, tableWidget , pMW->options, ":/ui/recursos/ExtrasInsert.png"); QObject::connect(pWidget,SIGNAL(clicked()), pMW->options, SLOT(on_pushButton_newJump_clicked())); It works fine.
  • QScrollArea

    Unsolved qscrollarea qt creator image display show images
    5
    0 Votes
    5 Posts
    997 Views
    cfdevC
    @Sai-Raul Look : https://doc.qt.io/qt-5/qscrollarea.html Whitout Qlablel.. There is QGraphicsScene with QGraphicsView.
  • How to uncheck the action on the toolbar

    Solved
    5
    0 Votes
    5 Posts
    733 Views
    Gojir4G
    @Mihan said in How to uncheck the action on the toolbar: So does it meen I must setChecked(false) by myself in lower version? Yes.
  • This topic is deleted!

    Unsolved
    5
    0 Votes
    5 Posts
    197 Views
  • Access violation in QImage from QRenderCapture

    Solved
    13
    0 Votes
    13 Posts
    1k Views
    O
    @Argostin Good job!
  • QLabel image load

    Unsolved qlabel show images c++ qscrollarea
    8
    0 Votes
    8 Posts
    2k Views
    mrjjM
    @Sai-Raul ok. but Qlabels only likes pixmaps.
  • This topic is deleted!

    Unsolved
    7
    0 Votes
    7 Posts
    34 Views
  • New window open from a click of a button (Cmake)

    Unsolved
    2
    0 Votes
    2 Posts
    299 Views
    JonBJ
    @Rashed cmake is not relevant. That is just for building your project. Start by reading Signals & Slots, you need to understand this concept before you can achieve anything in Qt. Then connect() your QPushButton::clicked signal to a slot you write, or an inbuilt slot on a Qt widget, which opens a new window, e.g. some kind of QWidget::show(). a new window (which is again editable) "Windows" are not "editable". Depends what you really mean here.
  • QLowEnergyController disconnectFromDevice has no effect

    Unsolved
    3
    0 Votes
    3 Posts
    440 Views
    SlingyS
    Hi Robert, I have exactly the same problem as you described. Did you manage to solve it ? Thank you. Regards
  • Is it safe to connect a QObject's deleteLater to one of its own signals?

    Solved
    2
    0 Votes
    2 Posts
    393 Views
    fcarneyF
    deleteLater will be called in the order of the signal handlers were attached. However, it won't actually delete well after all the other signals have been handled. QObject obj1; QObject ob2; obj1.connect(&obj1, &QObject::somesig, &obj1, &QObject::deleteLater); obj1.connect(&obj1, &QObject::somesig, &obj2, &QObject::otherslot); This will call deleteLater before otherslot. But the delete won't happen until after these signals have been handled. It won't be until the next iteration of the event loop. It is common to use deleteLater with network response objects in addition to handlers on the finished (?) signal. This will cause the object to clean itself up, but the handler will also have an opportunity to "handle" the data.
  • QCheckBox to hide QTableWidget

    Unsolved
    2
    0 Votes
    2 Posts
    354 Views
    SGaistS
    Hi, Are you calling that code from a slot connected to the QCheckBox::stateChanged signal ? In any case, it could be simplified: pTable->setVisible(hideCheckBox->checkState() == Qt::Unchecked);
  • QSqlQuery error handling

    Solved
    16
    0 Votes
    16 Posts
    3k Views
    KroMignonK
    @SPlatten AFAIK, QSqlQuery::record() is to be used after QSqlQuery::exec() to get the field information of the current query. So you can find the indexes of the value and decode faster the results: if(query.exec("SELECT * from MyTable where status = 2")) { auto record = query.record(); int nameCol = record.indexOf("name"); while(query.next()) qDebug() << "Found:" << query.value(nameCol ).toString(); } Which is faster as using query.value("name").toString()
  • Qml Column not resizing when bottom item visible goes false

    Unsolved
    1
    0 Votes
    1 Posts
    178 Views
    No one has replied
  • QGraphicsTextItem Single Line

    Solved
    2
    0 Votes
    2 Posts
    203 Views
    cfdevC
    Finally I use an QLineEdit for editing and use QGraphicsTextItem only to display with setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); See the result : [image: dev05.gif]
  • having trouble reading from textstream

    Unsolved
    2
    0 Votes
    2 Posts
    207 Views
    JonBJ
    @kook said in having trouble reading from textstream: QString str = in.readAll(); ... while (in.readLineInto(&line)) If you have already done a readAll() from the stream, where do you expect a subsequent readLineInto() to start reading from? Either do your work on the str containing all the read data or don't do that and do the readLineInto(), not both. Or if you do want to use both as you have shown, it is not surprising you have to go datafile.seek(pos); to reposition the reader; but I would either do everything off the str or everything off the in.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Qt Installer Framework: How to delete components with an online installer?

    Unsolved
    1
    0 Votes
    1 Posts
    166 Views
    No one has replied
  • Proper use of QPrivateSignal

    Unsolved
    8
    1 Votes
    8 Posts
    6k Views
    jeremy_kJ
    @KroMignon said in Proper use of QPrivateSignal: @jeremy_k said in Proper use of QPrivateSignal: Did you try the code above? QTimer::timeout is a private signal, and yet still callable using a clang 13 C++. Sorry, now I understand what you are meaning... sad situation :( Or curious. I don't know if this is a failure with Qt, C++, or my understanding.