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. Accessing Image inside a Tab
Qt 6.11 is out! See what's new in the release blog

Accessing Image inside a Tab

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.2k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    redmars
    wrote on last edited by
    #1

    I have a TabView in which Tab elements are added dynamically with a child Scrollview and Image, to make the image scrollable.

    I use the addTab(title, component) method of TabView to add this Component:
    @
    Component {
    id: itemTab

    ScrollView {
        anchors.fill: parent
    
        Image {
            fillMode: Image.PreserveAspectFit
            width: tabView.width
            height: tabView.height
        }
    }
    

    }
    @
    Now, as my image source has to be dynamic, how can I access the Image element to set its source from the addTab() method?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      redmars
      wrote on last edited by
      #2

      well, I solved the issue by setting an alias property for image in ScrollView and accessing the ScrollView using the item property of Tab.

      1 Reply Last reply
      0

      • Login

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