Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • OpenUrl from a QGraphicsView [Solved]

    4
    0 Votes
    4 Posts
    3k Views
    J
    Thanks, I switched to using a button and worked fine. Thanks.
  • Getting data from a lot of QMaps into one QMap.

    6
    0 Votes
    6 Posts
    7k Views
    A
    Why don't you try your debugger, and see where your application crashes exactly?
  • QDateTime timezones

    3
    0 Votes
    3 Posts
    4k Views
    D
    yes, sorry =) I am realy use an automatic translation, and I am really post original topic on russian section. It is very good news about timezones support in 5 version. I think it is necessary feature. Thanks for answer.
  • QTextEdit: How to create nested lists starting on level 2?

    2
    0 Votes
    2 Posts
    3k Views
    C
    It looks like there is actually no way to do that with QDocument. I ended up reimplementing this behavior myself.
  • & symbol before identifer

    4
    0 Votes
    4 Posts
    2k Views
    A
    To get a literal & symbol in a user-visible string like a label or a menu entry, double the &. A single & is used for automatic shortcut creation.
  • Prevent to show default windows context menu in winEvent

    6
    0 Votes
    6 Posts
    4k Views
    C
    I'm sorry. Somehow you are right. So you need to filter "WM_CONTEXTMENU":http://msdn.microsoft.com/en-us/library/windows/desktop/ms647592(v=vs.85).aspx and not WM_RBUTTONUP. About result, it should be @ *result = DefWindowProc(message->hwnd, WM_CONTEXTMENU, message->wParam, message->lParam) @
  • Mapper fails to submit: QDataWidgetMapper, QSqlRelationalTableModel

    7
    0 Votes
    7 Posts
    7k Views
    F
    I duplicated this problem, did you ever resolve it, if so how? I did note that in my code, the function returned true; but the database did not persist the data changes. Update: I tried submitAll on the model and it worked; I think that is your problem as well.
  • Relational Table Model Example not persisting data

    2
    0 Votes
    2 Posts
    3k Views
    F
    So far this is my feeling about all the SQL Examples: Do not share the the connection.h; unless you want them all to use the same database; in which case; you will have to create all your databases here; or make a call to another function in the app; lets say, createDatabase, such that it only gets called once and will not step on another examples create or modify calls; in other words; write this function so it detects the existence of the database file, then create all tables, indexes, and add data to them; that may work for examples; in real life; its a bad idea, unless both apps are using the same database. In fact: I'd recommend not teaching people bad practices; which as a DBA I would consider this as; these are examples of totally different concepts; and do not have a reason to share a common database; if space is an issue; then making them in memory will solve that problem (default, by the way); just document this feature; and maybe set a directive or variable to switch to a real database or memory model of it. This should just be a function in the main body of code; it should never be hidden in a header file, I over looked the header file at first; many do; its another bad practice in my opinion; keep the code simple; easy to follow; so keep it all in once file will like functions. It would require a bit more code; but if you just added a function call on exit to test to see if the control is dirty; you could prompt the user for a Save option. Examples say a lot about a product; you want your examples, samples or demo apps to work great; it shows your medal; I was disappointed with these examples; and they need to be updated, the underlying code and format is fine; so all I'm saying is to just update these examples so they at least work, use good practices; and are easy to understand; I like more comments in the code; they should tell the story, not a book, reading the code is a lost art, I have been a computer programmer since 1979, I do remember all the changes, all the languages, all the millions of lines of code I have seen over those years; and the code that I liked the most; had lots of comments. This is Open Source, and I have no problem updating these examples; but I have gone there before in other projects, just to be ignored; and it did sore me, so its best to ask if there is any chance that my efforts would even be worth it; otherwise I'll just do what everyone else does; complain about it; boy that is Open Source at work for you; but I don't see that in this project yet, so I have hope, that is why I'm writing this. On a side note; this is 11-11-11, Friday and Veterans Day, and I just happen to be a Disabled Gulf War Vet, Medically Retired U.S. Air Force, my wife was also in the Air Force; you see how I spend my time; can't go out and celebrate, so I say home, and do what I can do; so to all the Vets out there, thanks. Is this the right forum to be asking about Example Code? If not, can I get a moderator to move it please. Thanks
  • ToStdWString() unresolved external

    4
    0 Votes
    4 Posts
    3k Views
    F
    Here's how I've worked around it (sometimes you don't have the option of rebuilding): https://developer.qt.nokia.com/wiki/toStdWStringAndBuiltInWchar
  • [Solved] Label on UI Form not changing

    2
    0 Votes
    2 Posts
    2k Views
    K
    In such situations you can try removing the build folder. It will make QtCreator to recompile all modules of your project, which fixes some problems.
  • [Solved] Can't move QPushButton in QGraphicsScene?

    16
    0 Votes
    16 Posts
    16k Views
    B
    Thanks, thats a good idea. I think you are saying that you don't need to create a dependency on QWidget (shouldn't, since the QGui module is deprecated on some platforms?) Instead the Qt style API has all you need to insure that the style of your custom GUI items (whatever you call them: widgets, controls, etc.) conform to the platform's guidelines and the user's preferences. Don't arbitrarily fabricate a style attribute if it can come from the Qt style API. This is pertinent to my case because I am implementing a custom control that in a QGraphicsView. It is a tracking button. It appears on hover. It can be clicked. It follows the mouse (to a certain extent.) It is part of a tracking menu (a tracking menu is a set of tracking buttons.) I am studying whether it needs to be a QWidget (so that it receives mouseMoveEvent easily) or a QGraphicsItem. This is different from what Rokemoon wants (his tracks, ie follows the mouse, when clicked, mine tracks before clicked.) The handling of mouseMoveEvent seems to be easier if it is a QWidget, but as you suggest, it could be a QGraphicsItem as in Qt Quick. I need to study Qt Quick and the design reasons their controls are QGraphicsItems. It is very interesting the differences between event dispatch in QWidget trees and QGraphicItem trees.
  • [SOLVED]QSortFilterProxyModel checked

    5
    0 Votes
    5 Posts
    4k Views
    T
    //NEW Nothing happens I'm not sure that I did this OK Here is my h class @#include <QBrush> #include <QSortFilterProxyModel> class BlinkingRows :public QSortFilterProxyModel { Q_OBJECT public: BlinkingRows(QObject* parent = 0); BlinkingRows(); ~BlinkingRows(); void setBlinkBrush(const QBrush& brush); bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; private: QBrush m_brush; };@ and the implementation @#include "blinkingrows.h" BlinkingRows::BlinkingRows(QObject* parent) {} BlinkingRows::BlinkingRows() {} BlinkingRows::~BlinkingRows() { delete this; } bool BlinkingRows::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { if (!source_parent.isValid()) return false; if (source_parent.data(Qt::CheckStateRole).toInt() == Qt::Unchecked) return true; return false; } void BlinkingRows::setBlinkBrush(const QBrush& brush) { m_brush = brush; } @ And in the code i do like these @ proxy->setSourceModel(dataModel); proxy->setFilterWildcard("YES"); proxy->setFilterKeyColumn(5); blinkrows = new BlinkingRows(proxy); blinkrows->setSourceModel(proxy); blinkrows->setFilterKeyColumn(6);@ and later i dont want the checked rows in my QSFPM @void Tabelview::checkBlink() { if (blinkrows->rowCount()<1) return; for (int i = 0;i&lt;blinkrows-&gt;rowCount();i++) { if (!blinkrows->filterAcceptsRow(i,blinkrows->index(i,0))) blinkrows->removeRow(i,blinkrows->index(i,0)); } } @ so when I try to change color or blink as it should look like I only do like this in a TimerSlot @if (hidden) { blinkrows->setBlinkBrush(blue); hidden = false; } else { blinkrows->setBlinkBrush(yellow); hidden = true; }@ it doesnt work as I want to
  • Proxy

    4
    0 Votes
    4 Posts
    3k Views
    L
    I Connected the signal error and made setApplicationProxy but the program result do not change, it keep in the line get infinitely. regards luis.
  • 0 Votes
    6 Posts
    4k Views
    A
    Haven't been able to resolve this, so I've gone back to using shared libraries for my prototype. When I get the prototype working, I will need to revisit this issue.
  • Problem: Connect with SQL to windows SQL server 2008 .mdf

    11
    0 Votes
    11 Posts
    8k Views
    T
    Yes, we've tested QTCPSocket and its perfectly possible to send and receive data between our visual basic server. And what you're saying is true, so is will keep SQLite in mind and see what we can do to optimize our project. Greetings, Tristan
  • A question about using my Qt application commercially.

    4
    0 Votes
    4 Posts
    3k Views
    T
    I am not a lawyer, consult one if this has financial implications for you. As far as I understand you will need to make any changes to Qt itself public when you distribute your code using Qt under the LGPL. You can distribute a commercially licensed version of your code using Qt -- as far as I know without any special limitations. You can also buy a commercial license from Digia if that is not enough for you.
  • SSL in Standard Framework

    3
    0 Votes
    3 Posts
    6k Views
    C
    I have OpenSLL dll's included in Qt sdk, both for MinGW and VC. They are in QtSDK/Desktop/Qt/4.7.4/mingw or msvc2008/bin directory. As Volker said is sufficient to have libeay32.dll and ssleay32.dll in search path or in folder where your exe is.
  • Run program from cmd

    9
    0 Votes
    9 Posts
    5k Views
    F
    It is not clear at all, but are you sure your "external" application is really writing to that file? Are you sure when you start reading from such file the other application has flushed buffers and made data persistent? Are you sure the file_1 close is not within the while loop? Is it possible to see some debug output?
  • General Guidance on Organizing a Touch Screen Program

    2
    0 Votes
    2 Posts
    2k Views
    K
    I recommend you QtQuick for this purposes. It is QGraphicsView-based, but allows you to create animations, transitions (like screen transitions) , drag and drop and so on much easier.
  • Mac sudo authorization help

    37
    0 Votes
    37 Posts
    19k Views
    G
    This code works for me: @ void MainWindow::pushButton1Pressed() { bool ok; QString password = QInputDialog::getText( this, tr("Password"), tr("Password:"), QLineEdit::Normal, "", &ok); if(!ok || password.isEmpty()) return; // proc is a QProcess pointer defined in the class if(!proc) { proc = new QProcess(this); connect(proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); } else { // terminate a probably running process proc->kill(); } proc->start("sudo -S id"); proc->write(password.toLocal8Bit()); proc->write("\n"); proc->closeWriteChannel(); } void MainWindow::processFinished(int exitCode, QProcess::ExitStatus exitStatus) { QString finished = QString("exitCode=%1\nstatus=%2\n").arg(exitCode).arg(exitStatus); finished += proc->readAllStandardOutput(); QMessageBox::information(this, "Process Output", finished); } @