Seite 1 von 1

[QT4.1] Layoutfehler?

Verfasst: 4. Februar 2006 15:08
von Esleborn
hi,
ein Widget enthält im Kostruktor den folgenden Code:

Code: Alles auswählen

   QVBoxLayout *pvl_main = new QVBoxLayout ( );
   pvl_main->addStretch ( 1 );

   QHBoxLayout *phl_progress = new QHBoxLayout;
   pvl_main->addLayout ( phl_progress, 0 );

   mp_progressBar = new QProgressBar ( this );
   mp_progressBar->setTextVisible ( false );
   mp_progressBar->setMinimum ( 0 );
   QHBoxLayout *phl_playControl = new QHBoxLayout;
   pvl_main->addLayout ( phl_playControl, 0 );

   mp_backward = new QAction ( CreateIcon ( ImageSettingsPath ( "Player/Backward", "player/backward.png" ) ),
   /* <-- */      /* <-- */      /* <-- */      tr ( "Voheriges" ) , this );
   connect ( mp_backward, SIGNAL ( triggered ( ) ), this, SLOT ( Backward ( ) ) );
   mp_backward_button = new W_ToolButton ( this, false );
   mp_backward_button->setDefaultAction ( mp_backward );
   mp_backward_button->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
   mp_backward_button->setIconSize ( m_iconSize );

   mp_playPause = new QAction ( CreateIcon ( ImageSettingsPath ( "Player/Play", "player/play.png" ) ),
   /* <-- */      /* <-- */      /* <-- */      tr ( "Play/Pause" ) , this );
   connect ( mp_playPause, SIGNAL ( triggered ( ) ), this, SLOT ( SwitchPlayMode ( ) ) );
   mp_playPause_button = new W_ToolButton ( this, false );
   mp_playPause_button->setDefaultAction ( mp_playPause );
   mp_playPause_button->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
   mp_playPause_button->setIconSize ( m_iconSize );

   mp_stop = new QAction ( CreateIcon ( ImageSettingsPath ( "Player/Stop", "player/stop.png" ) ),
   /* <-- */      /* <-- */      /* <-- */      tr ( "Stop" ) , this );
   connect ( mp_stop, SIGNAL ( triggered ( ) ), this, SLOT ( Stop ( ) ) );
   mp_stop_button = new W_ToolButton ( this, false );
   mp_stop_button->setDefaultAction ( mp_stop );
   mp_stop_button->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
   mp_stop_button->setIconSize ( m_iconSize );

   mp_forward = new QAction ( CreateIcon ( ImageSettingsPath ( "Player/Forward", "player/forward.png" ) ),
   /* <-- */      /* <-- */      /* <-- */      tr ( "Nächstes" ) , this );
   connect ( mp_forward, SIGNAL ( triggered ( ) ), this, SLOT ( Forward ( ) ) );
   mp_forward_button = new W_ToolButton ( this, false );
   mp_forward_button->setDefaultAction ( mp_forward );
   mp_forward_button->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
   mp_forward_button->setIconSize ( m_iconSize );

   phl_playControl->addWidget ( mp_backward_button, 0, Qt::AlignCenter );
   phl_playControl->addWidget ( mp_playPause_button, 0, Qt::AlignCenter );
   phl_playControl->addWidget ( mp_stop_button, 0, Qt::AlignCenter );
   phl_playControl->addWidget ( mp_forward_button, 0, Qt::AlignCenter );

//   Eigentlicher Player (OS abhängig)
# ifdef WIN32
   mp_mp3Player = new QAxWidget ( );
   mp_mp3Player->setParent ( this );
   mp_mp3Player->hide ( );
   mp_mp3Player->setControl ( "{6BF52A52-394A-11d3-B153-00C04F79FAA6}" );
# endif

   setLayout ( pvl_main );
aus irgendeinem Grund werden die Buttons aber alle übereinander geziechnet... kann mir das einer erklären?