Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • 0 Votes
    3 Posts
    3k Views
    V
    nope ... here is the header and cpp files. I hope this help and thanks again. #ifndef ABPLAYER_H #define ABPLAYER_H #include <iostream> #include <string> #include <vector> #include <QWidget> #include <QListView> #include"hand.h" class AbPlayer : public Hand { friend ostream& operator<<(ostream& os, const AbPlayer& aAbPlayer); public: AbPlayer(const string& s); QString makeLabelString(); virtual void makePixmaps(AbPlayer& ) ; virtual ~AbPlayer(); //indicates whether or not generic player wants to keep hitting virtual bool isHitting() const = 0; //returns whether generic player has busted - has a total greater than 21 bool isBusted() const; //announces that the generic player busts QString bust() const; QString& getLabelQStr() const; string getName() const; protected: string name; Hand *hand; mutable QString labelQStr; }; #endif // ABSTRACTPLAYER_H #include <iostream> #include <typeinfo> #include <string> #include <vector> #include <algorithm> #include <ctime> #include <sstream> #include <QMessageBox> #include"AbPlayer.h" using namespace std; class QLabel; class QString; AbPlayer::AbPlayer(const string &s): name(s) { } string AbPlayer::getName() const { return name; } QString& AbPlayer::getLabelQStr() const { return labelQStr; } bool AbPlayer::isBusted() const { return (getTotal() > 21); } QString AbPlayer::bust() const { string str = ""; ostringstream oss ; oss << ""; oss << name << " bust! "; str = oss.str(); return str.c_str(); }
  • Qt- Web service Requests

    2
    0 Votes
    2 Posts
    4k Views
    M
    It seem that the service from that site only accepts application/x-www-form-urlencoded as Content-Type. Now it's working..
  • How to detect mouse over event when mouse over icon on item delegate

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • Format text in QLineEdit

    3
    0 Votes
    3 Posts
    9k Views
    D
    Sorry I wasn't clear. I don't want to constrain how the user enters the value, which is my understanding of input mask functionality. I want the user to be able to enter a number any way he wants, then when he's finished, display the number with appropriate formatting and appended units. For example, user enters: 123456.7891234 Component displays, for example: 123,456.79 km ... if the component units are set to kilometers, commas is true, and formatting is set for fixed notation with 2 decimals. Or, user enters: 1234567890123456789 Component displays 1.23e18 km I think I see how to take user input, check it for validity (using a validator as you suggested), and I know how to format the number, but I don't see how to set the string the QLineEdit will display without triggering additional validation, or losing undo?
  • QTouchEvent propagation.

    2
    0 Votes
    2 Posts
    1k Views
    M
    Actually I believe I need to keep the events from being grouped with the original touch if the only common parent is the graphicsview.
  • QTimer and performance on Windows

    2
    0 Votes
    2 Posts
    3k Views
    S
    What code do you use ? Do you use something like : @ QTimer *timer = new QTimer(this); timer->setInterval(1000 / 30); timer->start(); @ Maybe for having perfect 30 FPS, it is better to consider @ QGLWidget *widget = new QGLWidget(this); QGLFormat format = QGLFormat(); format.setSwapInterval(2); // Force drawing each 2 buffer swap widget->setFormat(format); @ It will block rendering thread on VSync, and if your screen is 60Hz, drawing each 2 buffer swaps will give 30FPS. Then, try to use @ timer->setInterval(0); @ This will tell the timer to tick when the event loop is finished. But since the rendering is blocked for 30FPS, the event loop will also block and then it will tick at 30FPS, aligned on VSync. This might fix the QTimer performances issues (as a workaround)
  • OpenGL and frame drop

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • QAxObject problem

    12
    0 Votes
    12 Posts
    22k Views
    H
    Ok, i have some progress - finally a i can read .doc files. That's great! But, unfortunately, there was another problem. I have read about "linebreak" in .doc files, instead "\n". Linebreak denotes "\v". In beginning it works, and ,i started think, what problem was solved, but suddenly, linebreak stopped denotes. In QString it was just empty symbol (""), my condition on detecting empty string was ignored: @ words = docA->querySubObject("Words"); QString textResult; //будущий результат int countWord = words->dynamicCall("Count()").toInt(); //кол-во слов в тексте QString testString; int asciiCode; //на самом деле он обманывает, считает зараза с пробелами :( for (int a = 1; a <= countWord; a++) { if(testString.count()==1) { asciiCode=testString.toLocal8Bit().toInt(); textResult.append("\v"); } else if(testString.isEmpty()) {-------//------------} else if(testString.isNull()) {-------//------------} else if(testString=="") {-------//------------} else if(testString=="\v") {-------//------------} else textResult.append(words->querySubObject("Item(int)", a)->dynamicCall("Text()").toString()); testString.clear(); } @ What the most intersting, that is ascii code of this empty symbol. It's =0. To tell the truth, i use integer number to detect the code, so I could be wrong. Please, help somebody with this!
  • Sharing some code with community

    2
    0 Votes
    2 Posts
    2k Views
    L
    You can post it as an open source project at "gitorious":https://gitorious.org/
  • Need QMacNativeWidget help/advice

    4
    0 Votes
    4 Posts
    3k Views
    B
    Thought I had already followed up on this, but seems my previous attempt didn't "stick"... The main issue turns out that Qt installs an event handler for kEventAppQuit by default, when one creates a QApplication instance. In the case where you're making a Qt widget with a native Mac window parent, and that widget is not the main window of your app, probably this is not what you want - "Quit" should be handled by the main app, and certainly not in a Qt dialog loaded by a plugin. The solution here is to simply add this line: @ QApplication::setAttribute(Qt::AA_MacPluginApplication); @ prior to declaring/creating your QApplication, and the Quit event goes back to being handled by the main application, as it ought to be. So, no need for trying to "talk" to the main event loop, etc. (see https://bugreports.qt-project.org/browse/QTBUG-8087 for relevant info...)
  • QtMobility play the same video in eight windows

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [Solved] QTcpSocket in a thread doesn't close pipes

    11
    0 Votes
    11 Posts
    7k Views
    L
    You're welcome.
  • Configure.exe parameter question for -webkit

    3
    0 Votes
    3 Posts
    3k Views
    M
    ok im still having a little trouble here! pretty much what im wanting to do is to be able to have the QT DLL's( qt core, qt gui... ) be compiled statically with my application so i don't have to redistribute them upon release. The problem is everything works according to plan during the compilation except for some reason when i specify configure -static -platform win32-msvc2010 it doesnt give my qt\lib folder Qtwebkitd.lib and QtWebkit.lib and so when i begin to compile my statically linked qt application, which is using QWebView the compiler spits the the following error LINK : fatal error LNK1104: cannot open file 'QtWebKitd.lib' Which it is right...i dont have this file in my qt lib file. Does anyone have any idea what im doing wrong?
  • ActiveQt and MS Office

    4
    0 Votes
    4 Posts
    4k Views
    I
    thank you for your help. but this is the opposite of what I would like to do. in this cases, they control Word with a Widget. I want to insert a widget in Word and activate it. I can insert the widget (Wrapper Example of Qt), but it didn’t work (I can't activate the Widget wich I insert into Word). thanks, rabat
  • Syntax error in "Creating a Qt Quick Application" example

    12
    0 Votes
    12 Posts
    6k Views
    K
    [quote author="stuarte9" date="1332515059"]Hi mlong, In my previous posting, that first "@" should be "[ c o d e ]" whilst the second "@" should be "[ / c o d e ]", without the spaces. I'll get the hang of this forum yet! ;-) Stuart [/quote] Sorry, I did not want to confuse you. I am always using the "@" for code wrappings, because it is simply faster. ;-)
  • How to keep a dialog window in front of others windows.

    8
    0 Votes
    8 Posts
    6k Views
    R
    That´s it! Thank you DerManu!:) Ricardo Sousa
  • QT with ODBC Driver cant connect to MSSQL

    2
    0 Votes
    2 Posts
    8k Views
    F
    Example of SQL Server Conection : @ QString ipserver,LoginName,database,Pass; QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", "MyDatabase"); db.setDatabaseName("DRIVER={SQL Server};Server="+ipserver+";Database="+database+";Uid="+LoginName+";Port=1433;Pwd="+Pass+";WSID="); if(db.open()) { qDebug() << "Opened"; db.close(); } else qDebug() << "Error" << db.lastError().text();@ the WSID =. “is used to hide the client machine to the database server log ,is optional .
  • Htonl() equivalent in Qt ? [SOLVED]

    2
    0 Votes
    2 Posts
    10k Views
    S
    "qToBigEndian":http://qt-project.org/doc/qt-4.8/qtendian.html#qToBigEndian-2 You may also be interested in "QDataStream":http://qt-project.org/doc/qt-4.8/qdatastream.html as it allows easy serialization of data, to format which is independent of system and processor.
  • QGraphicsView: Strange performance (at least on Mac)

    1
    0 Votes
    1 Posts
    966 Views
    No one has replied
  • 1. Open googlemaps - 2. Autofill search box - 3. Autoclick search button

    2
    0 Votes
    2 Posts
    2k Views
    G
    Hi and welcome to the forum. Qt is a C++ framework. And whether it can help you depends on how you are doing your stuff :-) How do you open the web link? in an external browser? or in an internal window in you app? If you want to use Qt, it would make sense to use Qt for all your things in this small project. You could use QWebView for the web site.