File: slidertab.cpp

package info (click to toggle)
qwt 6.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 23,808 kB
  • sloc: cpp: 57,687; xml: 182; makefile: 32
file content (37 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "slidertab.h"
#include "sliderbox.h"
#include <qlayout.h>

SliderTab::SliderTab( QWidget *parent ):
    QWidget( parent )
{
    int i;

    QBoxLayout *hLayout = createLayout( Qt::Vertical );
    for ( i = 0; i < 4; i++ )
        hLayout->addWidget( new SliderBox( i ) );
    hLayout->addStretch();

    QBoxLayout *vLayout = createLayout( Qt::Horizontal );
    for ( ; i < 7; i++ )
        vLayout->addWidget( new SliderBox( i ) );

    QBoxLayout *mainLayout = createLayout( Qt::Horizontal, this );
    mainLayout->addLayout( vLayout );
    mainLayout->addLayout( hLayout, 10 );
}

QBoxLayout *SliderTab::createLayout(
    Qt::Orientation orientation, QWidget *widget )
{
    QBoxLayout *layout =
        new QBoxLayout( QBoxLayout::LeftToRight, widget );

    if ( orientation == Qt::Vertical )
        layout->setDirection( QBoxLayout::TopToBottom );

    layout->setSpacing( 20 );
    layout->setMargin( 0 );

    return layout;
}