Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.9k Posts
  • [Solved] Qwt: Arrows pointing to data outside of current range

    2
    0 Votes
    2 Posts
    1k Views
    S
    Solved: After solving the problem how to insert an image into the plot it was not that hard to implement.
  • Transparency of QGLWidget on other QGLWidgets

    3
    0 Votes
    3 Posts
    2k Views
    B
    that can be a solution. Even if having almost 20 windows at the same time does not look logical according to me ... I will try to deal with it, while there is no other solutions. Many thanks for reply RainBoy
  • Qdialog box

    6
    0 Votes
    6 Posts
    2k Views
    M
    problem solved.thanks to all
  • Message Box

    6
    0 Votes
    6 Posts
    3k Views
    M
    ya finally I found the name and it's work .thanks to u for co-operating
  • 0 Votes
    2 Posts
    1k Views
    D
    Since this is program logic (the document name is not just something superficial that lives in the user interface, but an important property of the file representation in the application), even if it were possible to do it in QtDesigner – which I don't think it is – it should be done programmatically.
  • Txt vs. database

    4
    0 Votes
    4 Posts
    2k Views
    D
    [quote author="akonshi" date="1338729553"]the user shall be able to save one map into a file whenever he wants, it would me brilliant if the wouldnt be changed until the writing into it finished. Speed wouln't be very important neither when reading or writing a file. [/quote]Well in that case speed is actually important, since you're blocking your user from changing the map or playing the game (I'm assuming it's a game). Anyhow, a real database would be extreme overkill for this. Just save the file with QDataStream (that will be very fast for 200*200 map tile datasets). [quote author="akonshi" date="1338729553"]This QDataStream stuff seems to be good, i assume that the user won't need any additional programs for that? [/quote]Yes, that's right. [quote author="akonshi" date="1338729553"]It is forbidden for the user (!!!) to edit any file. Only the programm shall have access. It would be very dumb if you can change your score easily by hand...[/quote]You can't (and shouldn't) forbid your users to do anything they want with their files. If they want to change their highscore, they will, and should be allowed to, as long as it's local. If you want a global highscore, where players can compete and compare with eachother, you will need to set up a server which takes high score data. This is the only case where I agree with you, that the user should be prevented to manipulate this global highscore. But making this secure will be very hard, even professional game developers are having a hard time. As an example: How do you make sure the game isn't modified in a way so it just sends a higher score to the server than the original game would. The state-of-the-art way to prevent this is to run the game logic completely in an environment under your control – on a game server – and let the client only be the user interface, i.e. handle user actions and send them to the server and display/draw whatever game state the server sends back. If this is a casual game you're writing for fun and that won't have a user base above, say, 100 (i.e there will be no scandal if someone actually breaks highscores by hacking), just save the highscore in binary somewhere in your file. This will be impossible for normal users to hack by just opening with a text editor, and very easy to hack by someone with knowlege how to use a hex editor and how binary files work. The next step in security would be to encrypt either the entire file or the portion with the highscore with a hardcoded key (password). This way the hacker would need to disassemble your program and find out the password and the algorithm that is used for encryption, which will be a major hurdle for most scriptkiddies. If you want to go for encryption, either set up your own simple encryption algorithm (e.g. xor your data with a hard-coded key), or, if you want to use the big names in encryption, see the "Qt Cryptographic Architecture":http://delta.affinix.com/qca/. But I'd suggest you shouldn't waste your time with this, unless of course, you want to learn new things in this area. Rather concentrate on making a good game instead. Because if 95% of your users play the game, and the 5% of the users that hack the game, can hack it, but can't ruin the game for the 95%, you've got 100% satisified customers :).
  • How to change the QDialog background fill color?

    5
    0 Votes
    5 Posts
    9k Views
    L
    I believe it's because I'm using QtitanRibbon, and its style is affecting all child windows of the MainWindow. Their style object seems to have a bug in its setIgnoreDialogs() method, as it's not respecting that. Update: There is no bug in Qtitan, I placed the call in the wrong file. I now have it resolved. Thanks.
  • 0 Votes
    4 Posts
    2k Views
    D
    Through the Qt database classes, e.g. QSqlDatabase, QSqlQuery etc., with the "supported database backend":http://doc.qt.nokia.com/4.7-snapshot/sql-driver.html#supported-databases. See the docs of those two classes to see how to use them.
  • [Solved]QTableView resizeRowsToContents()

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • [SOLVED] Custom Delegate to repaint() if data changes in model.

    5
    0 Votes
    5 Posts
    11k Views
    S
    Thanks for the answers, I have made the required changes including emit dataChanged(). This is solved. Thanks for your time :)
  • QTableView don’t refresh with QSqlTableModel

    2
    0 Votes
    2 Posts
    4k Views
    C
    You should try to provide code that will compile and demonstrates the problem. There's no QSqlTablemodel::insertRecord() that accepts a single value for example. Here are some questions that might help you isolate the problem: Is the database connection is successfully opened? Did you check? Does a table called "student" exist in the database? Is dataStudentRecord a QSqlRecord that matches this model? QSqlTableModel::insertRow(), QSqlTableModel::setData(), QSqlTableModel::setRecord() and QSqlTableModel::submitAll() all return a value, did you check it? Are you sure your record is actually insertable and inserted? Does it violate database check or referential integrity constraints? When it fails, did you check the result of QSqlTableModel::lastError()? Updating the table other than through the model, i.e. by executing a QSqlQuery separately, will not update the view or model unless you reset the model.
  • Modify arrow head from Diagramscene Example

    3
    0 Votes
    3 Posts
    2k Views
    M
    OMG! Now I am in love with you! LOL I was thinking that nobody would answer me, but thanks a lot!
  • Changing parent of rowsInserted

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 0 Votes
    5 Posts
    7k Views
    M
    How does it not "move proper horizontally"? What happens when you click the move button? I must admit that I don't quite understand the code. To me it seems that your 12 lines are equivalent to @ float zoomfactor = 1 + val*0.05f; @ The first two lines seem to center the graphicsView on the point that already is its center. Then you calculate the zoomfactor, but in the code you wrote you didn't use it yet. And, if I understand you correctly, zooming works, so I would assume the problem is in the code for moving?
  • How to make variable QSqlQuery available within the project

    8
    0 Votes
    8 Posts
    3k Views
    W
    I don't know, but probably you should explicitly construct QVariant from qint.
  • Thread communication with no QThread present

    6
    0 Votes
    6 Posts
    3k Views
    E
    For what it's worth, I've seen no more problems since I adopted the method below (having given the camera object an extra member, namely a QWaitCondition called 'm_condition'). It turns out that QWaitCondition will work perfectly well when called from another thread that isn't a QThread: @void AcquireFrame() { bool frameReceived; forever { camera -> triggerImageAcquisition(); camera -> m_mutex.lock(); frameReceived = camera -> m_condition.wait(&camera->m_mutex, CAM_TIMEOUT); if (frameReceived) { // We received a frame from the camera, so can return: camera -> m_mutex.unlock(); return; } // If we got to here, then the wait condition must have timed out. We need to // unlock the mutex, go back to the beginning of the 'forever' loop and try // again: camera -> m_mutex.unlock(); } } void callback (camera *) { // Called by the camera driver from a separate OS thread - // not a QThread - when a frame is ready: camera -> m_condition.wakeOne(); }@ This still has the effect of pausing the main thread until we have either received a frame or experienced a timeout, but now we have eliminated the Sleep() and the Qt event loop remains in full control throughout. It's still not clear to me why the old method caused so many problems - I still suspect some sort of system resource limitation - but this new approach seems to be more lightweight and certainly works better.
  • Localization of a library

    30
    0 Votes
    30 Posts
    17k Views
    R
    Ok, but I found translations in qt_de.ts for error messages! I load qt_de.qm in MyApp, but my library doesn't use it! If I load qt_de.qm in MyLib, strings are still in english! Any special options to load it for libraries?
  • QT and C++ with QT Creator - how?

    5
    0 Votes
    5 Posts
    3k Views
    C
    AFAICT, you received two perfectly valid replies asking for information you did not volunteer in your initial post. I'm sorry that you feel that answering simple questions to address your problem is beneath your dignity. You quoted a Qt Creator manual for V2.1 but claimed to be using an unspecified "current" version that might have been 2.4 or 2.5 depending on exactly what you installed and when. It's not unreasonable to expect a difference between 2.1 and 2.4 or 2.5, just a Microsoft Visual Studio 2005 and 2010 are different. That's why both replies directed you to the current version manual. However, now we know you are using 2.4.1 you should use "this manual":http://doc.qt.nokia.com/qtcreator-2.4/index.html You observation about the Qt Project web site search is just mistaken as far as I can see, but feel free to post query term results in a link the ask.com. Your new observation: bq. If you choose a topic from the ‘Welcome’ screen, you can’t work it and then scroll that side screen: any dialog box blocks access to that side screen. If you mean that a modal dialog removes your ability to interact with the underlying application then yes, it is like every other GUI you've used in 20 years. You can read exactly the same manual in a web browser (or Qt Assistant) in order to read the documentation concurrently with operating Qt Creator modal dialogs.
  • System tray program that has short-cut key bindings

    4
    0 Votes
    4 Posts
    2k Views
    D
    [quote author="Ryein" date="1338619007"]I would but if I use QT it should be cross plateform right? Thanks btw. I am trying to find GlobalShortcut in the documentation and all I get is QShortcut is this the right one?[/quote] No, Qt itself doesn't support global shortcut yet. But you can find one from LIBQXT
  • Funny QRegExp whitespace behavior

    3
    0 Votes
    3 Posts
    3k Views
    P
    Tannin Thanks for the pointer. After reading your reply I found the note in the QRegExp documentation that tells me to use double backslashes. I tried it and it works with both QRegExp expresions. My compiler didn't give me a warning. I'm using Qt Creator 2.4.0 with the standard supplied compiler. After some additional testing it became clear that \s was being interpreted as the character s but that both \n and \n was being interpreted as a newline character (not sure why both works).