Skip to content
  • 0 Votes
    5 Posts
    485 Views
    A

    @jsulm Thanks , yes I missed this. now It's working ! Thank you

  • 0 Votes
    3 Posts
    255 Views
    M

    @SGaist said in Re-activate (known as create a new substance) a QMainWindow after the last QMainWindow is closed:

    Based on this feature request, you should be able to react on the ˋQEvent::ApplicationActivate`.

    I'm using that in a subclass of QApplication.
    The idea in pseudo code:

    void Application::applicationStateChanged ( Qt::ApplicationState state) { if(state==Qt::ApplicationActive AND no window is open AND OpenUntitledWindow ) { openNewWindow(); }

    OpenUntitledWindow is a flag setting if an new window/document should be opened on startup, it works also when the app is reactivated with the code above.

  • 0 Votes
    3 Posts
    2k Views
    U

    To add an icon to your qt quick app just follow these 2 easy steps:

    open the .qrc file where you have added your static images.

    If you don't have a qrc file in your project then do the following.

    This is the GUI way.
    ->Open your project in qt creator.
    ->Add new qt resources file, then open this file in your editor
    ->Press add files button and search and select your icon.
    ->Save the qrc file.

    Text Editor Way
    ->Open your qrc file in your favorite text editor and add the following lines.

    <RCC> <qresource prefix="/"> <file>images/logo.png</file> </qresource> </RCC>

    Note the qrc file must be added in the CMakeLists.txt file if you are using cmake or .pro file if you are using qmake.

    Open your main.cpp #include <QGuiApplication> #include <QIcon> int main(int argc, char** argv) { QGuiApplication app(argc, argv); QGuiApplication::setWindowIcon(QIcon(":/images/logo.png")); // next do whatever is needed. }
  • 0 Votes
    4 Posts
    734 Views
    Y

    @J-Hilk Thank you for answering the question.

  • 0 Votes
    9 Posts
    615 Views
    CJhaC

    @JonB Yeah, I was thinking of doing this because there are signals for both applicationDisplayNameChanged() & applicationNameChanged() this can provide me with an application-wide signal to change users. My application has different modules which are completely independent of each other (I have to develop a lot of custom applications where not each application has to have all modules, and so independent modules are the best idea), the common things among these modules are stored directly inside a namespace (every module is also inside this namespace) and so I need an application-level signal to propagate common settings for my application, i.e. current user master key, current font and current palette. For font and palette, QApplication provides the respective ..changed() signal but there is no way for me to add an application-level signal for the master user key without creating a singleton, which I very much want to avoid, that's why I was thinking of using applicationDisplayName as master user key :)

    @JonB @SGaist Thanks for the insight, I will figure out a different way then.

    P.S. It would be nice to have a void QCoreApplication::broadcast(const QString& string) signal, the string could be modified in different ways to provide different values to the broadcast :)

  • 0 Votes
    12 Posts
    5k Views
    0

    @Kent-Dorfman I'm sorry, but I steel don't get it...I have two physical monitors each of which is 1280x1024px. If they span into one display I should get a screen with 1280x2048 resolution, shouldn't I? But my screens list contains one an entity with {0, 1024, 1280, 1024} rect for available geometry. I can test what returns availableVirtualGeometry method tomorrow in the office, but no matter it does I can't find a way to render a GUI on the second physical monitor properly.

  • 0 Votes
    6 Posts
    2k Views
    SGaistS

    The Basic Drawing Example shows that. In your case, you'd likely just have to paint your image using the correct scaling information.

  • 0 Votes
    6 Posts
    2k Views
    J.HilkJ

    @MrCrackPotBuilder said in Detecting the removal of a screen and modifying the app accordingly.:

    Its also saying the same as before so I.m definitely going to have to use the QGuiApplication but how that i cant figure out... Yet

    you #include <QGuiApplication> in your class that than allows you access to the (unique) application instance pointer qApp than you can use that to update your Layout.

    QObject::connect(qApp, &QGuiApplication::screenCountChanged, this, &myClass::screenCountSlot);
  • 0 Votes
    6 Posts
    3k Views
    Chris KawaC

    Yeah, that looks ok.
    I wasn't suggesting to remove the flush permanently, just to see that the system background is drawing when you don't flush.

    Btw. Keep in mind that the system color can change at any time so if you want to be 100% correct you should either get it every time you render or handle the WM_SYSCOLORCHANGE and WM_THEMECHANGED messages.

  • Screens Info

    Unsolved QML and Qt Quick
    4
    0 Votes
    4 Posts
    1k Views
    SGaistS

    Do you have that error on both platforms ?

    By the way, can post a minimal sample code that shows this behaviour ?

  • 0 Votes
    11 Posts
    8k Views
    KiwiJeffK

    @SGaist Fixed it ;)

  • 0 Votes
    11 Posts
    3k Views
    D

    @ileonte Uh, i must use Qt5.3.1, coz our project demands this version....I think i have to read file to get target text string.

    Anyway, thank you~ :)

  • 0 Votes
    4 Posts
    2k Views
    JKSHJ

    @jking said:

    @JKSH That is helpful information. I had only added the QThread into my flow after not having success creating the QGuiApplication directly in the JNI function. Even without the QThread (and no other created QObjects), the QGuiApplication constructor never returns. I will attempt to debug into QT's code and find where it is getting stalled, but I was hoping someone had an idea of what could be wrong.

    There are no error printouts from QT that I can see in logcat so my current working theory is that I am missing something from the setup of QtActivity in my Service that perhaps the constructor waits on instead of running into an error condition.

    My goal is to have my service initialize several manager classes (which utilize qt signals and slots) and then continue to use the QGuiApplication in my main function when the QtActivity is started.

    Those are interesting symptoms. Sorry I'm not able to help you more with this.

    I suggest you subscribe to the Interest mailing list and ask there -- you can find Qt engineers on that list, who probably know more.

    Good luck!

  • 0 Votes
    2 Posts
    978 Views
    mmcmmcM

    oh i solved my question, int QDesktopWidget::screenNumber(const QPoint & point) const