Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Using (signal) to determine a specific page
Forum Updated to NodeBB v4.3 + New Features

Using (signal) to determine a specific page

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 225 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mamoudM Offline
    mamoudM Offline
    mamoud
    wrote on last edited by
    #1

    How can I use (signal) to know that i am on a specific page on my application. For example if I have 3 pages, and i want to say that i am on this specific page when i am on it by giving a signal.

    a sample code to describe what i want.

    Page1.qml

    Rectangle {
        id: page1
        width: 320
        height: 240
        clip: true
    
        signal  thisPageEnter // I want to use this signal to say that i am on page 1
        property bool change: false  // a variable i want to change when i enter this page 1
    
    }
    

    Page2.qml

    // If i was on another page and then entered page1 i want to change the value of (bool change)
    Page1{
        id:abc
        onThisPageEnter:{
            page1.change=true  // should I write like this
           conslo.log(change)
        }
    
    }
    

    I tried to do like this but did not work with me (did not show (true) in consol)

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      How are you creating the page1, page2 and page3 objects ? Where are you creating ? How do you navigate between the pages ? When are you emitting the signal ?

      If you are using the Loader to load the Page1, Page2 or Page3 every time, component.onCompleted signal is the best bet for you.

      If you are creating the object at one shot and just navigating, then your navigation signal should act like a trigger for you.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved