Results 1 to 7 of 7

Thread: MouseArea

  1. #1
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default MouseArea

    hi i have problem simple example:
    Qt Code:
    1. import QtQuick 1.1
    2.  
    3. Rectangle {
    4. id: root
    5. width: 360
    6. height: 360
    7. Rectangle {
    8. width: 200
    9. height: 100
    10. color: "red"
    11. }
    12.  
    13. Text {
    14. text: qsTr("Hello World")
    15. anchors.centerIn: parent
    16. }
    17. MouseArea {
    18. anchors.fill: parent
    19. onClicked: {
    20. Qt.quit();
    21. }
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 
    When i click on red rectangle i don't want close app how can i do that? And red rectangle mustoverlap the root rectangle

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MouseArea

    Quote Originally Posted by Viper666 View Post
    When i click on red rectangle i don't want close app how can i do that?
    Don't call Qt.quit()

    And red rectangle mustoverlap the root rectangle
    Set "anchors.fill: parent" and don't set the width and height.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MouseArea

    No you don't understand me. I have a listView and below is toolbar. When i click on toolBar it is same like when i click on 1 item in Listview but i don't want it i try something like
    Qt Code:
    1. ListView {
    2. height: root.height- toolbar.height
    3. }
    To copy to clipboard, switch view to plain text mode 
    But this don't work

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MouseArea

    I don't understand what you mean. There is no toolbar and no list view in the code you posted. I have no idea what one has to do with the other.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MouseArea

    That was only simple example i have other app. I post here only simple app which explain my problem. In my app i have a ListView and bellow i have my Toolbar. And ListView contain delegate which has MouseArea and slot onClicked and when i click on toolbar i emit signal onClicked on one item which is overlaping with toolbar. But i don't want emit this slot. Code which i posted explain this problem. Now i will talking about the code that i posted here. I simply want click on the red Rectangle but i don't want emit the signal which will quit the application. If you don't understand i will post video or full code.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MouseArea

    Quote Originally Posted by Viper666 View Post
    That was only simple example i have other app.
    So why did you post that code at all?

    I post here only simple app which explain my problem.
    Well... it didn't explain your problem.

    In my app i have a ListView and bellow i have my Toolbar. And ListView contain delegate which has MouseArea and slot onClicked and when i click on toolbar i emit signal onClicked on one item which is overlaping with toolbar. But i don't want emit this slot. Code which i posted explain this problem.
    It must be me then, I still have no idea what the code you posted has anything to do with some ListView. If you want two items to not overlap each other then anchor them properly. It's the most basic thing in QML.

    Now i will talking about the code that i posted here. I simply want click on the red Rectangle but i don't want emit the signal which will quit the application. If you don't understand i will post video or full code.
    I already answered that part of your question -- don't call Qt.quit() in the onClicked handler.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MouseArea

    I will sent a video but now i have urgent problem. This app is for android but in my phone it don't load jpeg but i don't know how can i add this plugin to my project. It is simply if i deploy for Linux or Win i can simply copy imageformat but how add this to android i want link jpeg plugin into my app

Similar Threads

  1. Replies: 0
    Last Post: 11th December 2011, 22:51
  2. Replies: 1
    Last Post: 24th October 2011, 14:49
  3. Replies: 2
    Last Post: 16th July 2011, 12:39
  4. Problem with MouseArea element
    By chiru in forum Qt Quick
    Replies: 1
    Last Post: 27th November 2010, 00:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.