Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Import resources in Qt Creator

    Unsolved
    2
    0 Votes
    2 Posts
    617 Views
    mrjjM
    Hi After you added the files to the res file, do you build the project ? (sorry the screenshots cant be uploaded here directly as its broken)
  • 0 Votes
    5 Posts
    436 Views
    mrjjM
    @Gabber Hi It's fine to close it and then just open another one in case you got new questions. This will keep the posts shorter and easier for newcomers to look at if they search for solutions.
  • QMake -- how to test for build type (release, debug)

    Solved
    4
    0 Votes
    4 Posts
    286 Views
    D
    Thank you. I was just going to reply that I found CONFIG on the qmake tests page, but y'all beat me to it. :) Thank you for the quick replies!
  • degrees, radians can't learn to use them

    Solved
    4
    0 Votes
    4 Posts
    303 Views
    JonBJ
    degrees, radians can't learn to use them Radians are for mathematicians, maybe physicists. Degrees are for the rest of us :)
  • QDateTimeAxis - how to set format of date the same as system has, but without time?

    Unsolved
    2
    0 Votes
    2 Posts
    213 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
    927 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
    543 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
    989 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
    727 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
    294 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
    437 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
    390 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
    351 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
    200 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]