Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • How to find the collidal coordinates

    2
    0 Votes
    2 Posts
    2k Views
    F
    Maybe this helps "intersection":http://doc.qt.nokia.com/stable/qrect.html#intersected
  • [Moved] qt creator build a dll

    6
    0 Votes
    6 Posts
    4k Views
    W
    @ C# code using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace ConsoleApplication1 { public static class Test { [DllImport("qtcpdll.dll", EntryPoint="start", CallingConvention=CallingConvention.Cdecl)] public extern static int start(); } } /////////////////////////////////////////// using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int res = Test.start(); Console.WriteLine(res); Console.Read(); } } } /////////////////////////////////////////// QT CODE tcpserver #ifndef SERVER_H #define SERVER_H #include <QObject> #include <QTcpServer> #include <QTcpSocket> class server : public QObject { Q_OBJECT public: explicit server(QObject *parent = 0); QTcpServer *tserver; QTcpSocket *socket; public slots: void newConnect(); void receiveMSG(); }; #endif // SERVER_H //server.cpp #include "server.h" server::server(QObject *parent) : QObject(parent) { tserver = new QTcpServer; if(tserver->listen(QHostAddress::Any, 9999)) qWarning("listing on 9999"); connect(tserver, SIGNAL(newConnection()), this, SLOT(newConnect())); } void server::newConnect() { socket = tserver->nextPendingConnection(); connect(socket, SIGNAL(readyRead()), this, SLOT(receiveMSG())); } void server::receiveMSG() { QByteArray data; data.resize(socket->bytesAvailable()); socket->read(data.data(), data.size()); qWarning("receive# %s", data.data()); } @ Thread running normally now. I was in the project which added a "tcpserver", used to monitor the connection and receive messages. In C # to call when the client "socket" shows the state is "already connected", but in C # where not receive data, "incomingConnection" function has not been called. If I use QT to use the DLL functions can be done, then, C # in the die. Is no event loop ah?
  • [SOLVED]problem with setCentralWidget

    5
    0 Votes
    5 Posts
    10k Views
    L
    Well, I took a quick look at the sources and in fact the central widget is only deleted if the new central widget is actually different from the current central widget. This means the subsequent calls to setCentralWidget() using the same widget will work. So the problem only arises if you pass another central widget before passing the current central widget again (as in your case).
  • [SOLVED]suggestion for actions default behavior when uncheked

    3
    0 Votes
    3 Posts
    2k Views
    F
    I was looking for a simpler out-of-the-box way, but since it is not so hard to coding this one, I will take it! Thanks.
  • How to know the timezone using Qt classes.

    3
    0 Votes
    3 Posts
    2k Views
    L
    You might take a look at "QTBUG-71":https://bugreports.qt.nokia.com/browse/QTBUG-71.
  • Converting void pointer to qstring

    14
    0 Votes
    14 Posts
    11k Views
    G
    We have no idea which program sends you messages and how to interpret them. Contact the one who wrote it.
  • Activated signal in QTreeView

    3
    0 Votes
    3 Posts
    7k Views
    A
    It don't work on windows platform if double-clicking on item. I know that this is not the same as "selected", but with selected (click signal) it works, I mean it enters my slot, but if I use activated signal it never get there (even when I enter item, change value and press "Enter" key). So I need to know when the signal activated is emitted in my case? Maybe it don't work because I use item delegate ?
  • How to know if a file is a text file or a binary file?

    11
    0 Votes
    11 Posts
    12k Views
    F
    sorry soroush !!! since my keywords used for searching this particular topic didn't find me any solution and I didn't done much research on it. Since QT guys always repsonded me quickly!!! :) yes, I thought of making it as separate question. But, got more interested in finding solution(New to C++ and QT) .!!
  • Using OpenCV in Qt

    2
    0 Votes
    2 Posts
    5k Views
    M
    did you try google? "qt-opencv-combined-for-face-detecting-qwidgets":http://www.morethantechnical.com/2009/03/05/qt-opencv-combined-for-face-detecting-qwidgets/
  • [SOLVED]what signal to capture in order to sync filename

    2
    0 Votes
    2 Posts
    2k Views
    V
    May be this signal can help you @void QFileSystemModel::fileRenamed ( const QString & path, const QString & oldName, const QString & newName ) [signal] @ bq. This signal is emitted whenever a file with the oldName is successfully renamed to newName. The file is located in in the directory path.
  • File errors in Ubuntu

    8
    0 Votes
    8 Posts
    4k Views
    M
    Ahhhh....many thanks, the flushing/closing did the trick, many thanks fluca.
  • Generateds the mysql drivers

    3
    0 Votes
    3 Posts
    2k Views
    P
    yes,you are right, but first thing is how I can find that directory? and go to there by using cd>
  • Qtextstream and Qfile

    4
    0 Votes
    4 Posts
    6k Views
    K
    Well, as I wrote seeing all text in one line does not necessarily mean that there is no newline in windows. Do you have a lister allowing to see it as hex? You may also try to write '\r' and '\n' at the line end. [Edit] Just saw this in the doc: [quote]Note: On Windows, all '\n' characters are written as '\r\n' if QTextStream's device or string is opened using the QIODevice::Text flag. [/quote] So if you write on windows the translation is enforced in Qt. Do you open the file as a text file as recommended?
  • QMenu or QToolBar with a common action slot?

    3
    0 Votes
    3 Posts
    3k Views
    F
    Excellent! Exactly what I was looking for, thanks a lot.
  • [Solved] QMenuBar && menu's order

    7
    0 Votes
    7 Posts
    6k Views
    L
    Ok, I solved inserting the "Help" menu too with insertMenu() instead of addMenu() so I get a QAction that I can use for all the menus I must insert before "Help". Thanks.
  • How to access QT element from different file

    4
    0 Votes
    4 Posts
    5k Views
    G
    No, you don't. You have @ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT private: Ui::MainWindow *ui; }; @ which means, you have a pointer to the ui. This means, you must use text edit like this: @ ui->textEdit->setText("test"); @
  • 0 Votes
    4 Posts
    3k Views
    T
    thank you, looked at event, but don't know how I missed the button()... stupid me.. :)
  • What is the maximum length of string that QString object can hold?

    7
    0 Votes
    7 Posts
    23k Views
    A
    2^30 is 1073741824 characters, but QString being UTF16, that means a memory usage of 2.147.483.648 bytes, plus some additional bytes around that. For a single piece of data in your application. That's 2 GB worth of data, if I'm not mistaken. Not the best idea to keep that in a single block of memory, and then I am not even talking yet of temporaries that might also be in memory at the same time (like a byte array of the same size from a file you just read, for instance). To summarize: if you find yourself wondering about reaching this limit, you had better start wondering about your design at a more fundamental level.
  • Searching in directories

    4
    0 Votes
    4 Posts
    2k Views
    M
    [quote author="Vass" date="1318337511"]Try look to [[Doc:QFileInfo]] class. Also I recommend you look to [[Doc:QDirModel]] and [[Doc:QFileSystemModel]] classes.[/quote] Oh... I've posted mine without refreshing :/ You can use both. Qdir to list, QFileInfo to get the... File info ;)
  • Scroll Area and Widgets repaint

    6
    0 Votes
    6 Posts
    4k Views
    G
    it shopuld be clipped by the base system, so normaly, I would say: nothing to be done here.