Error: Could not resolve SDK path for ‘macosx10.8’

The problem is that the online installer for Qt currently supports OSX 10.8 (Mountain Lion) by default, and I’m guessing you are on 10.9 (Mavericks) or greater. There is a workaround: Navigate to where you installed Qt (default /Users/your username/Qt) using finder Go to the subdirectory 5.3/clang_64/mkspecs directory Open the file called qdevice.pri with a …

Read more

First random number is always smaller than rest

I’m not sure that could be classified as a bug, but it has an explanation. Let’s examine the situation: Look at rand’s implementation. You’ll see it’s just a calculation using the last generated value. You’re seeding using QTime::currentTime().msec(), which is by nature bounded by the small range of values 0..999, but qsrand accepts an uint …

Read more

Is it possible to create web application using Qt?

This depends on what you mean by “web application”. If you mean an application that can show parts of a web page in its interface as rendered HTML, like a browser can…yes. Qt incorporates something called QtWebKit: (Note: Back in the olden days it was Microsoft–I think–who first made an embeddable Internet Explorer control …

Read more

How to append text to QPlainTextEdit without adding newline, and keep scroll at the bottom?

I’ll just quote what I found here: We just need to move the cursor to the end of the contents in the QTextEdit and use insertPlainText. In my code, it looks like this: myTextEdit->moveCursor (QTextCursor::End); myTextEdit->insertPlainText (myString); myTextEdit->moveCursor (QTextCursor::End); As simple as that. If your application needs to keep the cursor where it was …

Read more

Fullscreen widget

QWidget::showFullScreen() is what you need – works great under Linux+Windows in my projects for years – but be careful, there shouldn’t be two calls of this function (eg. first call of QMainWindo->showFullScreen() and then MyWidget->showFullScreen()). ciao, Chris

How to determine the correct size of a QTableWidget?

The thread How to set a precise size of QTableWidget to prevent from having scroll bars? (Qt-interest Archive, June 2007) between Lingfa Yang and Susan Macchia seems to resolve my question. I will post more details shortly, if my testing works. Update #1: My test now generates the nice-looking window: The complete test code for …

Read more