Beispiel #1
0
TQHBox *KJanusWidget::addHBoxPage( const TQString &itemName,
				  const TQString &header,
				  const TQPixmap &pixmap )
{
  TQStringList items;
  items << itemName;
  return addHBoxPage(items, header, pixmap);
}
VoiceDialog::VoiceDialog
	(NMainFrameWidget *mainWidget, int staffNr, QList<NStaff> *staffList) :
	KDialogBase
		(Tabbed,                               //  dialogFace
		 kapp->makeStdCaption(i18n("Voices")), //  caption
		 Help | User1 | Ok | Apply | Cancel,   //  buttonMask
		 Close,                                //  defaultButton
		 mainWidget,                           //  parent
		 "VoiceDialog",                        //  name (for internal use only)
		 true,                                 //  modal
		 true,                                 //  separator
		 i18n("C&reate voice")                 //  user1
		),
		mainWidget_(mainWidget),
		staffList_(staffList)
{
	unsigned int i = 1;
	QHBox * firstHBox = 0;
	for
		(QListIterator<NStaff> staffIterator(*staffList);
		 staffIterator.current();
		 ++staffIterator, ++i
		) {
		pageList_.append(new QList<VoiceBox>());
		QHBox *currentPage = addHBoxPage
			(staffIterator.current()->staffName_.isEmpty() ?
			 i18n("Staff %1").arg(i) :
			 staffIterator.current()->staffName_,
			 QString::null
			);
		if (firstHBox == 0) firstHBox = currentPage;
		QListIterator<NVoice> voiceIterator(staffIterator.current()->voicelist_);
		unsigned int j = 1;
		for
			(QListIterator<NVoice>
				voiceIterator(staffIterator.current()->voicelist_);
			 voiceIterator.current();
			 ++voiceIterator, ++j
			) {
			pageList_.current()->append
				(new VoiceBox(currentPage, this, 0, j, voiceIterator.current()));
		}
	}
	firstPageIdx_ = pageIndex(firstHBox); /* there seems to be a bug in activePageIndex() it does not start with 0 */
	showPage(staffNr);
}