Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Merge item in QGridLayout
Forum Updated to NodeBB v4.3 + New Features

Merge item in QGridLayout

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 350 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.
  • H Offline
    H Offline
    Hai Anh Luu
    wrote on last edited by Hai Anh Luu
    #1

    Recently I'm working with QGridLayout. I want when I select 2 or 4 items in GridLayout, those 4 items will be merged together into 1 large item. Take a look at the photo below, these are images from another application, I want to get the same result:
    27b82b87-8bb7-4b89-82ea-0b59520cf8b4-image.png

    After i press Joint button:
    a7be902e-b7ca-49c4-8e7b-6e92cca2aee5-image.png

    Then I got grid like this:
    f1cb21d7-04fe-4325-85a6-ed8137a3e04d-image.png

    I can get the row-col of the selected item, but I don't know how to merge the selected items into one large item and redraw the grid. Help me please

    JonBJ 1 Reply Last reply
    0
    • H Hai Anh Luu

      Recently I'm working with QGridLayout. I want when I select 2 or 4 items in GridLayout, those 4 items will be merged together into 1 large item. Take a look at the photo below, these are images from another application, I want to get the same result:
      27b82b87-8bb7-4b89-82ea-0b59520cf8b4-image.png

      After i press Joint button:
      a7be902e-b7ca-49c4-8e7b-6e92cca2aee5-image.png

      Then I got grid like this:
      f1cb21d7-04fe-4325-85a6-ed8137a3e04d-image.png

      I can get the row-col of the selected item, but I don't know how to merge the selected items into one large item and redraw the grid. Help me please

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Hai-Anh-Luu
      "Merging" must be achieved by spanning rows and/or columns.
      void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = Qt::Alignment())
      and similar allow this when placing an item. I do not see a method to alter the spanning once an item has been added.

      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