Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Camera class in QThread

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    C
    @stryga42 @Christian-Ehrlicher @jsulm Thanks, I fixed it!
  • 0 Votes
    9 Posts
    2k Views
    SGaistS
    Thanks for the code ! You can use the Q_OS_XXX macros to ifdef your code.
  • Installing Qt 4.8.7 on Mojave

    Unsolved
    7
    0 Votes
    7 Posts
    798 Views
    SGaistS
    Hi, One of the main issue is: 4.8.7 has reached end of life before Mojave was released. You may have better luck checking with macports or brew if they still provide it.
  • BackgroundRole color change not taking effect in QTableView with stylesheet

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    Christian EhrlicherC
    @cdemuru said in BackgroundRole color change not taking effect in QTableView with stylesheet: It works fine except when I apply a stylesheet. As described in the documentation: "Note: If Qt Style Sheets are used on the same widget as functions that set the appearance of widgets, such as QWidget::setFont() or QTreeWidgetItem::setBackground(), style sheets will take precedence if the settings conflict." Use a custom QStyledItemDelegate.
  • How to force a thread waiting for signal

    Unsolved
    21
    0 Votes
    21 Posts
    6k Views
    dualD
    @Christian-Ehrlicher your answer totally solved my problem. Thank you so much.
  • MaintenanceTool.dat, how to modify?

    Unsolved
    1
    0 Votes
    1 Posts
    199 Views
    No one has replied
  • Application Keep Crashing

    Solved c++
    5
    0 Votes
    5 Posts
    555 Views
    E
    @jsulm Its worked!Thanks dude =D
  • How to get row and columns count in QGridLayout?

    Solved
    4
    0 Votes
    4 Posts
    4k Views
    JonBJ
    @TomNow99 Yes, I had realized this after I typed my answer, and was thinking of deleting it! So since as you say the accepted answer there is at https://stackoverflow.com/a/13406780/489865, isn't that as good as it gets? But otherwise it refers you to https://stackoverflow.com/a/19256990/489865, where that solution states: Removing a row or column (or even a single cell) from a QGridLayout is tricky First, note that QGridLayout::rowCount() and QGridLayout::columnCount() always return the number of internally allocated rows and columns in the grid layout. Note that it's unfortunately impossible to remove such an internal row or column from the grid layout. In other words, the row and column count of a grid layout can always only grow, but never shrink. So isn't that your answer? You seem to be saying you don't like the answers there! :)
  • QScreen DPI Confusion

    Solved
    3
    0 Votes
    3 Posts
    361 Views
    A
    Thank you very much Kent, I fear you are right. I've actually been debugging this issue with Qt support and it seems that the BenQ SW271 is either reporting incorrect information to the operating system or it is being recognised incorrectly by the operating system. In the "About My Mac" window, macOS thinks the screen is 61-inch (3840 x 2160)! And hence the incorrect DPI :-/ I've now written to BenQ's support. The ticket was escalated to the technical team and I'm waiting for reply. Luckily, the printing works perfectly so it's not stopping the app from working correctly at the end of the day.
  • Unable to restore my Application

    Unsolved
    26
    0 Votes
    26 Posts
    2k Views
    JonBJ
    @ELEMENTICY I'm not with you? Of course you can keep whatever code you want for your application, I was only talking about removing everything unnecessary while you post your minimal code/diagnose what the problem is. Then you can put whatever back in. Meanwhile, I showed you 5 lines of code, and asked for a "yes" or "no" as to whether it worked for you with a QWidget versus with a QMainWindow, which you say is where your real problem lies?
  • wiring pi setup

    Unsolved
    3
    0 Votes
    3 Posts
    223 Views
    Kent-DorfmanK
    As said above, not the correct forum...ask on the pi support page.
  • Sizing and scaling widgets on a single PDF page

    Unsolved
    1
    0 Votes
    1 Posts
    151 Views
    No one has replied
  • qmake to cmake, are there any tools to help automate this?

    Unsolved cmake qmake
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    AFAIK, it's the script that was used to bootstrap the port from qmake to cmake so it should do a pretty good job.
  • How to get ItemWidget in QGroupBox?

    Solved
    2
    0 Votes
    2 Posts
    163 Views
    Christian EhrlicherC
    It should but better use QObject::findChild<>().
  • QList thread safety

    Solved
    2
    0 Votes
    2 Posts
    2k Views
    Christian EhrlicherC
    As long as you only use those three functions (which I doubt) it's fine although I would prefer a mutex outside the QList instead. And I would use a QMutexLocker instead manual lock/unlock.
  • QPainter coordinate system World->NDC->View transforms

    Solved
    5
    0 Votes
    5 Posts
    920 Views
    PsnarfP
    PolarGraph::PolarGraph() { int imageWidth = 600, imageHeight = 600; image = new QImage(imageWidth, imageHeight, QImage::Format_RGB32); image->fill(Qt::white); painter = new QPainter(image); painter->setRenderHint(QPainter::Antialiasing); View.setSize(QSize(imageWidth, imageHeight)); painter->setViewport(View); painter->setViewTransformEnabled(true); Window.setTopLeft(QPoint(-300, 300)); Window.setBottomRight(QPoint(300,-300)); painter->setWindow(Window); painter->setWorldMatrixEnabled(true); World.setTopLeft(QPointF(-10.,10.)); World.setBottomRight(QPointF(10.,-10.)); QPen myPen; myPen.setColor(Qt::lightGray); myPen.setWidth(1); painter->setPen(myPen); for (qreal i = 0; i < 360; i+=45) { painter->save(); painter->rotate(i); painter->drawLine(QPoint(-300,0), QPoint(300,0)); painter->restore(); } QPoint center(0, 0); painter->drawEllipse(center,50,50); painter->drawEllipse(center,150,150); painter->drawEllipse(center,299,299); myPen.setColor(Qt::black); myPen.setWidth(2); painter->setPen(myPen); plotLemniscate(); image->save("lemniscate.png"); plotCardiod(); image->save("cardiod.png"); plotCurve1(); image->save("curve1.png"); plotCurve2(); image->save("curve2.png"); } void PolarGraph::plotCurve1() { // r=2cos(Θ/3) qreal r; for (qreal theta = 0.; theta < M_PI*2; theta += 0.01) { r = qCos(theta/3.); plotRTheta(r, theta); plotRTheta(r, -theta); } } void PolarGraph::plotCurve2() { // r=cos3Θ qreal r; for (qreal theta = 0.; theta < M_PI*2; theta += 0.01) { r = qCos(theta * 3.); plotRTheta(r, theta); } } void PolarGraph::plotLemniscate() { // r^2 = sin(2Θ) // r = +-sqrt(sin(2Θ) qreal r; for (qreal theta = 0.; theta < M_PI*2; theta += 0.01) { r = qSqrt(qSin(theta * 2.)); plotRTheta(r, theta); plotRTheta(-r, theta); } } void PolarGraph::plotCardiod() { // r=1-cosΘ qreal r; for (qreal theta = 0.; theta < M_PI * 2.; theta += 0.01) { r = 1 - qCos(theta); plotRTheta(r, theta); } } void PolarGraph::plotRTheta(qreal R, qreal Theta) { QPoint Pv; QPointF Pw; Pw = QPointF(R, 0.); qreal thetaDegrees = qRadiansToDegrees(Theta); int x; Pv = World2View(Pw); x = Pv.x(); painter->save(); painter->rotate(thetaDegrees); painter->drawPoint(x,0); painter->restore(); } QPoint PolarGraph::World2View(QPointF Pworld) { // Transform matrix from Foley & van Dam _Computer Graphics_ Ch 5.5, fig 5.15 /* View-ViewMin World-WorldMin * --------------- = ------------------- * ViewMax-ViewMin WorldMax-WorldMin * * Vmax-Vmin * V = ---------(W-Wmin)+Vmin = S(W-Wmin)+Vmin * Wmax-Wmin */ QPoint Pview; QPointF PviewF; Vmax = Window.topRight(); Vmin = Window.bottomLeft(); QPointF WtopLeft = QPointF(-5., 5.); QPointF WbottomRight = QPointF(5., -5); World = QRectF(WtopLeft, WbottomRight); Wmax = QPointF(World.topRight()); Wmin = QPointF(World.bottomLeft()); Sx = ( Vmax.x() - Vmin.x() ) / ( Wmax.x() - Wmin.x() ); Sy = ( Vmax.y() - Vmin.y() ) / ( Wmax.y() - Wmin.y() ); PviewF.setX(Sx * (Pworld.x() - Wmin.x()) + Vmin.x()); PviewF.setY(Sy * (Pworld.y() - Wmin.y()) + Vmin.y()); Pview = PviewF.toPoint(); return Pview; }
  • Why std::exception make QCoreApplication::exec() avoid terminating the application?

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    AlienA
    Dear @Christian-Ehrlicher , thanks. you are right
  • Installation of dryscrape with Qt

    Unsolved
    4
    0 Votes
    4 Posts
    469 Views
    JonBJ
    @glycogen So I have given you a bunch of references/quotes to look through. You can see others did not succeed. And the fact remains that Qt WebKit is not supplied since Qt 5.5. (Though you have instructions from the wiki page you referenced if you want to try it.) And even the author of the dryscape package states it probably should not used. What would you like?
  • automatic Size policy when resizing window

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    JonBJ
    @SimonChoops You seemed to ask several different questions, it's not clear (to me, maybe others) just what it is you want. What resizing did you want/expect? When did "resize text" come into what you were asking? Resize in what way? I see you have lines commented out which had setFont() and a text size number, is that what you want/expect to change? So the font changes size when other things resize??
  • QComboBox how to change tab stop width?

    Solved
    3
    0 Votes
    3 Posts
    364 Views
    M
    Hello Christian, I'll will look into the QStyledItemDelegate and see how it works. Thank you for the help!