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. Problems with blank space in the list widget

Problems with blank space in the list widget

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 339 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by IknowQT
    #1

    50c595ea-c75a-490f-b41d-8d7e2867aa0d-image.png

    There is white space in the list widget.
    What should I do in this case? Because I put the list widget inside the frame, it should look stretched.
    Click in the margin to make a selection as well.

    for (int i = (int)cModelCommon::CELL_TYPE::Single; i < (int)cModelCommon::CELL_TYPE::Max; i++)
    	{
    		QSize btnSize(30, this->size().height() * 11 / 100);
    
    		QListWidgetItem*	pItem = new QListWidgetItem(this->ui.listWidget);
    		usrCellTypeButton*	pBtn  = new usrCellTypeButton(this);
    		{			
    			pBtn->setMinimumSize(btnSize);
    			pBtn->setFont(cGlobalParam::gGetCellTypeFont());
    			pBtn->SetBtnID(i); 
    			pBtn->setCheckable(true);
    			
    			if( i == (int)cModelCommon::CELL_TYPE::Single || i == (int)cModelCommon::CELL_TYPE::Multi )
    				pBtn->SetTitle(m_pModelInfo->EnumtoStringCellType((cModelCommon::CELL_TYPE)i)+" Cell");
    			else
    				pBtn->SetTitle(m_pModelInfo->EnumtoStringCellType((cModelCommon::CELL_TYPE)i));
    
    			m_pBtnGroup->addButton(pBtn, i);
    		}
    
    		pItem->setSizeHint(btnSize);
    		this->ui.listWidget->addItem(pItem);
    		this->ui.listWidget->setItemWidget(pItem, pBtn);
    	}
    
    jsulmJ 1 Reply Last reply
    0
    • jsulmJ jsulm

      @IknowQT What about posting code where you add your list widget to the frame? Did you add the list widget to a layout in the frame?

      I Offline
      I Offline
      IknowQT
      wrote on last edited by
      #3

      @jsulm

      That space was the position of the scrollbar. I don't know why, but the scrollbar doesn't appear properly. I hide it with Qt::ScrollBarAlwaysOff so it is displayed normally.

      1 Reply Last reply
      0
      • I IknowQT

        50c595ea-c75a-490f-b41d-8d7e2867aa0d-image.png

        There is white space in the list widget.
        What should I do in this case? Because I put the list widget inside the frame, it should look stretched.
        Click in the margin to make a selection as well.

        for (int i = (int)cModelCommon::CELL_TYPE::Single; i < (int)cModelCommon::CELL_TYPE::Max; i++)
        	{
        		QSize btnSize(30, this->size().height() * 11 / 100);
        
        		QListWidgetItem*	pItem = new QListWidgetItem(this->ui.listWidget);
        		usrCellTypeButton*	pBtn  = new usrCellTypeButton(this);
        		{			
        			pBtn->setMinimumSize(btnSize);
        			pBtn->setFont(cGlobalParam::gGetCellTypeFont());
        			pBtn->SetBtnID(i); 
        			pBtn->setCheckable(true);
        			
        			if( i == (int)cModelCommon::CELL_TYPE::Single || i == (int)cModelCommon::CELL_TYPE::Multi )
        				pBtn->SetTitle(m_pModelInfo->EnumtoStringCellType((cModelCommon::CELL_TYPE)i)+" Cell");
        			else
        				pBtn->SetTitle(m_pModelInfo->EnumtoStringCellType((cModelCommon::CELL_TYPE)i));
        
        			m_pBtnGroup->addButton(pBtn, i);
        		}
        
        		pItem->setSizeHint(btnSize);
        		this->ui.listWidget->addItem(pItem);
        		this->ui.listWidget->setItemWidget(pItem, pBtn);
        	}
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @IknowQT What about posting code where you add your list widget to the frame? Did you add the list widget to a layout in the frame?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        I 1 Reply Last reply
        0
        • jsulmJ jsulm

          @IknowQT What about posting code where you add your list widget to the frame? Did you add the list widget to a layout in the frame?

          I Offline
          I Offline
          IknowQT
          wrote on last edited by
          #3

          @jsulm

          That space was the position of the scrollbar. I don't know why, but the scrollbar doesn't appear properly. I hide it with Qt::ScrollBarAlwaysOff so it is displayed normally.

          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