You are not logged in.

1

Monday, May 23rd 2005, 4:38pm

QHBox

Hi @ll,

i use QT 3.3.3 Windows Version:

I can't align my QPushButtons on the left side it will be everytime aligned to the right side.

Here is the code:

m_wordlistBox = new QVBox( m_splitterRight, "wordListBox" );
if ( m_wordlistBox ) {
m_keyInfo2 = new sv::keyInfoWidget( m_wordlistBox, "wordlistInfo" );
//Buttons in a QHBox
m_wordlistHBox = new QHBox( m_wordlistBox, "m_wordlistControls" );
if ( m_wordlistHBox ) {
m_wordlistHBox->setSpacing( 3 );
m_wordlistEntryRename = new QPushButton( "Rename", m_wordlistHBox, "m_wordlistEntryRename" );
m_wordlistEntryInsert = new QPushButton( "Insert", m_wordlistHBox, "m_wordlistEntryInsert" );
m_wordlistEntryDelete = new QPushButton( "Delete", m_wordlistHBox, "m_wordlistEntryDelete" );
m_wordlistEntryImportFromFile = new QPushButton( "<Import...>", m_wordlistHBox, "m_wordlistEntryImportFromFile" );
m_wordlistHBox->layout()->addItem( new QSpacerItem( 1, 1, QSizePolicy::Expanding ) );
}
m_wordlist = new sv::wordListViewer( m_wordlistBox, "wordlist" );
}



Thanks for helping!!!

Cu,

DevCow

2

Tuesday, May 24th 2005, 7:57am

Bug or to simple problem?

3

Tuesday, May 24th 2005, 8:41am

Hello DevCow,

Try with QHBoxLayout instead of QHBox.

for example :

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Form1Layout = new QGridLayout( this, 1, 1, 11, 6, "Form1Layout"); 

    layout1 = new QHBoxLayout( 0, 0, 6, "layout1"); 

    pushButton1 = new QPushButton( this, "pushButton1" );
    layout1->addWidget( pushButton1 );

    pushButton2 = new QPushButton( this, "pushButton2" );
    layout1->addWidget( pushButton2 );

    pushButton3 = new QPushButton( this, "pushButton3" );
    layout1->addWidget( pushButton3 );
    spacer1 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout1->addItem( spacer1 );


please use the button "#" to make your code more readable as in my example.

Cheers

4

Tuesday, May 24th 2005, 10:24am

thanks!!!