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. Drawing Frames arround Widgets
Qt 6.11 is out! See what's new in the release blog

Drawing Frames arround Widgets

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 4 Posters 7.0k Views 2 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.
  • S sandro4912

    @J-Hilk

    No it still has the same Issue:

        auto topLayout = new QHBoxLayout;
        topLayout->setSpacing(0);
        topLayout->setContentsMargins(0,0,0,0);
        topLayout->addWidget(mLcdDisplayMinesLeft);
        topLayout->addWidget(mSmileyPushButton);
        topLayout->addWidget(mLcdDisplayElapsedTime);
        mTopFrame->setLayout(topLayout);
    
        auto bottomLayout = new QHBoxLayout;
        bottomLayout->setSpacing(0);
        bottomLayout->setContentsMargins(0,0,0,0);
        bottomLayout->addWidget(mMinefield);
        mBottomFrame->setLayout(bottomLayout);
    
        auto mainLayout = new QVBoxLayout;
        mainLayout->setSpacing(0);
        mainLayout->setContentsMargins(0,0,0,0);
        mainLayout->addWidget(mTopFrame);
        mainLayout->addWidget(mBottomFrame);
    
        mMainFrame->setLayout(mainLayout);
    
        auto layout = new QVBoxLayout;
        layout->setSpacing(0);
        layout->setContentsMargins(0,0,0,0);
        layout->addWidget(mMainFrame);
    
        setLayout(layout);
    

    Result:
    e9de883c-65c2-4d40-8e1b-c83887644194-image.png

    J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by
    #21

    @sandro4912
    mmh, strange.

    I'm out of easy ideas to try 😞
    sry


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #22

      Hi
      What about INSIDE minefield ?
      Did you use layout there ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sandro4912
        wrote on last edited by
        #23

        Yes inside the Minfield I place the Cells like this in the constructor:

        auto layout = new QGridLayout;
           layout->setSpacing(0);
        
           for(int i = 0; i < mCells.size(); ++i) {
               auto column = static_cast<int>(i %  mFieldWidth);
               auto row = static_cast<int>(i /  mFieldWidth);
        
               layout->addWidget(mCells[i], row, column);
           }
        
           setLayout(layout);
        
        mrjjM 1 Reply Last reply
        0
        • S sandro4912

          Yes inside the Minfield I place the Cells like this in the constructor:

          auto layout = new QGridLayout;
             layout->setSpacing(0);
          
             for(int i = 0; i < mCells.size(); ++i) {
                 auto column = static_cast<int>(i %  mFieldWidth);
                 auto row = static_cast<int>(i /  mFieldWidth);
          
                 layout->addWidget(mCells[i], row, column);
             }
          
             setLayout(layout);
          
          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #24

          @sandro4912

          But you dont seem to call setContentsMargins(0,0,0,0);
          so maybe that is the space ?

          S 1 Reply Last reply
          2
          • mrjjM mrjj

            @sandro4912

            But you dont seem to call setContentsMargins(0,0,0,0);
            so maybe that is the space ?

            S Offline
            S Offline
            sandro4912
            wrote on last edited by
            #25

            @mrjj said in Drawing Frames arround Widgets:

            setContentsMargins(0,0,0,0);

            thats it!

            d4167070-a480-4188-9923-57d57cb94d35-image.png

            I thought i tryed it before but i think i tryed:

            setContentsMargins(0,0,0,0);
            

            and not

            layout->setContentsMargins(0,0,0,0);
            
            1 Reply Last reply
            2

            • Login

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