AmountUnitInput::AmountUnitInput( QWidget *parent, RecipeDB *database, Unit::Type type, MixedNumber::Format format ) : KHBox(parent), m_item(0), m_database(database) { amountInput = new FractionInput(this,format); unitBox = new UnitComboBox(this,database,type); unitBox->reload(); connect( amountInput, SIGNAL(valueChanged(const MixedNumber &)), SLOT(emitValueChanged()) ); connect( unitBox, SIGNAL(activated(int)), SLOT(emitValueChanged()) ); connect( amountInput, SIGNAL(returnPressed()), SIGNAL(doneEditing()) ); }
// ****************************************************************************************** // Create the edit widget // ****************************************************************************************** QWidget* VirtualJointsWidget::createEditWidget() { // Main widget QWidget *edit_widget = new QWidget( this ); // Layout QVBoxLayout *layout = new QVBoxLayout(); // Simple form ------------------------------------------- QFormLayout *form_layout = new QFormLayout(); //form_layout->setContentsMargins( 0, 15, 0, 15 ); form_layout->setRowWrapPolicy( QFormLayout::WrapAllRows ); // Name input vjoint_name_field_ = new QLineEdit( this ); form_layout->addRow( "Virtual Joint Name:", vjoint_name_field_ ); // Child Link input child_link_field_ = new QComboBox( this ); child_link_field_->setEditable( false ); form_layout->addRow( "Child Link:", child_link_field_ ); // Parent frame name input parent_name_field_ = new QLineEdit( this ); form_layout->addRow( "Parent Frame Name:", parent_name_field_ ); // Type input joint_type_field_ = new QComboBox( this ); joint_type_field_->setEditable( false ); loadJointTypesComboBox(); // only do this once //connect( joint_type_field_, SIGNAL( currentIndexChanged( const QString & ) ), // this, SLOT( loadJoinSliders( const QString & ) ) ); form_layout->addRow( "Joint Type:", joint_type_field_ ); layout->addLayout( form_layout ); // Bottom Buttons -------------------------------------------------- QHBoxLayout *controls_layout = new QHBoxLayout(); controls_layout->setContentsMargins( 0, 25, 0, 15 ); // Spacer QWidget *spacer = new QWidget( this ); spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); controls_layout->addWidget( spacer ); // Save QPushButton *btn_save_ = new QPushButton( "&Save", this ); btn_save_->setMaximumWidth( 200 ); connect( btn_save_, SIGNAL(clicked()), this, SLOT( doneEditing() ) ); controls_layout->addWidget( btn_save_ ); controls_layout->setAlignment(btn_save_, Qt::AlignRight); // Cancel QPushButton *btn_cancel_ = new QPushButton( "&Cancel", this ); btn_cancel_->setMaximumWidth( 200 ); connect( btn_cancel_, SIGNAL(clicked()), this, SLOT( cancelEditing() ) ); controls_layout->addWidget( btn_cancel_ ); controls_layout->setAlignment(btn_cancel_, Qt::AlignRight); // Add layout layout->addLayout( controls_layout ); // Set layout ----------------------------------------------------- edit_widget->setLayout(layout); return edit_widget; }
// ****************************************************************************************** // Constructor // ****************************************************************************************** KinematicChainWidget::KinematicChainWidget( QWidget *parent, moveit_setup_assistant::MoveItConfigDataPtr config_data ) : QWidget( parent ), config_data_( config_data ) { // Basic widget container QVBoxLayout *layout = new QVBoxLayout( ); // Label ------------------------------------------------ title_ = new QLabel( "", this ); // specify the title from the parent widget QFont group_title_font( "Arial", 12, QFont::Bold ); title_->setFont(group_title_font); layout->addWidget( title_ ); // Create link tree ------------------------------------------------------ link_tree_ = new QTreeWidget( this ); link_tree_->setHeaderLabel( "Robot Links" ); connect( link_tree_, SIGNAL( itemSelectionChanged() ), this, SLOT( itemSelected() ) ); layout->addWidget( link_tree_ ); // Create Grid Layout for form -------------------------------------------- QGridLayout *form_grid = new QGridLayout(); form_grid->setContentsMargins( 20, 20, 20, 20 ); // left top right bottom // Row 1: Base Link QLabel *base_link_label = new QLabel( "Base Link", this ); form_grid->addWidget( base_link_label, 0, 0, Qt::AlignRight ); base_link_field_ = new QLineEdit( this ); base_link_field_->setMinimumWidth( 300 ); form_grid->addWidget( base_link_field_, 0, 1, Qt::AlignLeft ); QPushButton *btn_base_link = new QPushButton( "Choose Selected", this ); connect( btn_base_link, SIGNAL( clicked() ), this, SLOT( baseLinkTreeClick() )); form_grid->addWidget( btn_base_link, 0, 2, Qt::AlignLeft ); // Row 2: Tip Link QLabel *tip_link_label = new QLabel( "Tip Link", this ); form_grid->addWidget( tip_link_label, 1, 0, Qt::AlignRight ); tip_link_field_ = new QLineEdit( this ); tip_link_field_->setMinimumWidth( 300 ); form_grid->addWidget( tip_link_field_, 1, 1, Qt::AlignLeft ); QPushButton *btn_tip_link = new QPushButton( "Choose Selected", this ); connect( btn_tip_link, SIGNAL( clicked() ), this, SLOT( tipLinkTreeClick() )); form_grid->addWidget( btn_tip_link, 1, 2, Qt::AlignLeft ); // Add form grid layout layout->addLayout( form_grid ); // Bottom Controls --------------------------------------------------------- QHBoxLayout *controls_layout = new QHBoxLayout(); // Expand/Contract controls QLabel *expand_controls = new QLabel( this ); expand_controls->setText("<a href='expand'>Expand All</a> <a href='contract'>Collapse All</a>"); connect( expand_controls, SIGNAL(linkActivated( const QString )), this, SLOT( alterTree( const QString ))); controls_layout->addWidget( expand_controls ); // Spacer QWidget *spacer = new QWidget( this ); spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); controls_layout->addWidget( spacer ); // Save QPushButton *btn_save = new QPushButton( "&Save", this ); btn_save->setMaximumWidth( 200 ); connect( btn_save, SIGNAL(clicked()), this, SIGNAL( doneEditing() ) ); controls_layout->addWidget( btn_save ); controls_layout->setAlignment(btn_save, Qt::AlignRight); // Cancel QPushButton *btn_cancel = new QPushButton( "&Cancel", this ); btn_cancel->setMaximumWidth( 200 ); connect( btn_cancel, SIGNAL(clicked()), this, SIGNAL( cancelEditing() ) ); controls_layout->addWidget( btn_cancel ); controls_layout->setAlignment(btn_cancel, Qt::AlignRight); // Add layout layout->addLayout( controls_layout ); // Finish Layout -------------------------------------------------- this->setLayout(layout); // Remember that we have no loaded the chains yet kinematic_chain_loaded_ = false; }
KRegExpEditorPrivate::KRegExpEditorPrivate(TQWidget *parent, const char *name) : TQWidget(parent, name), _updating( false ), _autoVerify( true ) { setMinimumSize(730,300); TQDockArea* area = new TQDockArea(Qt::Horizontal, TQDockArea::Normal, this ); area->setMinimumSize(2,2); TQDockArea* verArea1 = new TQDockArea(Qt::Vertical, TQDockArea::Normal, this ); verArea1->setMinimumSize(2,2); TQDockArea* verArea2 = new TQDockArea(Qt::Vertical, TQDockArea::Reverse, this ); verArea2->setMinimumSize(2,2); // The DockWindows. _regExpButtons = new RegExpButtons( area, "KRegExpEditorPrivate::regExpButton" ); _verifyButtons = new VerifyButtons( area, "KRegExpEditorPrivate::VerifyButtons" ); _auxButtons = new AuxButtons( area, "KRegExpEditorPrivate::AuxButtons" ); _userRegExps = new UserDefinedRegExps( verArea1, "KRegExpEditorPrivate::userRegExps" ); _userRegExps->setResizeEnabled( true ); TQWhatsThis::add( _userRegExps, i18n( "In this window you will find predefined regular expressions. Both regular expressions " "you have developed and saved, and regular expressions shipped with the system." )); // Editor window _editor = new TQSplitter(Qt::Vertical, this, "KRegExpEditorPrivate::_editor" ); _scrolledEditorWindow = new RegExpScrolledEditorWindow( _editor, "KRegExpEditorPrivate::_scrolledEditorWindow" ); TQWhatsThis::add( _scrolledEditorWindow, i18n( "In this window you will develop your regular expressions. " "Select one of the actions from the action buttons above, and click the mouse in this " "window to insert the given action.")); _info = new InfoPage( this, "_info" ); _verifier = new Verifier( _editor, "KRegExpEditorPrivate::_verifier" ); connect( _verifier, TQT_SIGNAL( textChanged() ), this, TQT_SLOT( maybeVerify() ) ); TQWhatsThis::add( _verifier, i18n("Type in some text in this window, and see what the regular expression you have developed matches.<p>" "Each second match will be colored in red and each other match will be colored blue, simply so you " "can distinguish them from each other.<p>" "If you select part of the regular expression in the editor window, then this part will be " "highlighted - This allows you to <i>debug</i> your regular expressions") ); _editor->hide(); _editor->setSizes( TQValueList<int>() << _editor->height()/2 << _editor->height()/2 ); TQVBoxLayout *topLayout = new TQVBoxLayout( this, 0, 6, "KRegExpEditorPrivate::topLayout" ); topLayout->addWidget( area ); TQHBoxLayout* rows = new TQHBoxLayout; // I need to cal addLayout explicit to get stretching right. topLayout->addLayout( rows, 1 ); rows->addWidget( verArea1 ); rows->addWidget( _editor, 1 ); rows->addWidget( _info, 1 ); rows->addWidget( verArea2 ); // Connect the buttons connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), _scrolledEditorWindow, TQT_SLOT( slotInsertRegExp( int ) ) ); connect( _regExpButtons, TQT_SIGNAL( doSelect() ), _scrolledEditorWindow, TQT_SLOT( slotDoSelect() ) ); connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), _scrolledEditorWindow, TQT_SLOT( slotInsertRegExp( RegExp* ) ) ); connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), _userRegExps, TQT_SLOT( slotUnSelect() ) ); connect( _regExpButtons, TQT_SIGNAL( doSelect() ), _userRegExps, TQT_SLOT( slotUnSelect() ) ); connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), _regExpButtons, TQT_SLOT( slotUnSelect() ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( doneEditing() ), _regExpButtons, TQT_SLOT( slotSelectNewAction() ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( doneEditing() ), _userRegExps, TQT_SLOT( slotSelectNewAction() ) ); connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), this, TQT_SLOT( slotShowEditor() ) ); connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), this, TQT_SLOT( slotShowEditor() ) ); connect( _regExpButtons, TQT_SIGNAL( doSelect() ), this, TQT_SLOT( slotShowEditor() ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( savedRegexp() ), _userRegExps, TQT_SLOT( slotPopulateUserRegexps() ) ); connect( _auxButtons, TQT_SIGNAL( undo() ), this, TQT_SLOT( slotUndo() ) ); connect( _auxButtons, TQT_SIGNAL( redo() ), this, TQT_SLOT( slotRedo() ) ); connect( _auxButtons, TQT_SIGNAL( cut() ), _scrolledEditorWindow, TQT_SLOT( slotCut() ) ); connect( _auxButtons, TQT_SIGNAL( copy() ), _scrolledEditorWindow, TQT_SLOT( slotCopy() ) ); connect( _auxButtons, TQT_SIGNAL( paste() ), _scrolledEditorWindow, TQT_SLOT( slotPaste() ) ); connect( _auxButtons, TQT_SIGNAL( save() ), _scrolledEditorWindow, TQT_SLOT( slotSave() ) ); connect( _verifyButtons, TQT_SIGNAL( autoVerify( bool ) ), this, TQT_SLOT( setAutoVerify( bool ) ) ); connect( _verifyButtons, TQT_SIGNAL( verify() ), this, TQT_SLOT( doVerify() ) ); connect( _verifyButtons, TQT_SIGNAL( changeSyntax( const TQString& ) ), this, TQT_SLOT( setSyntax( const TQString& ) ) ); connect( this, TQT_SIGNAL( canUndo( bool ) ), _auxButtons, TQT_SLOT( slotCanUndo( bool ) ) ); connect( this, TQT_SIGNAL( canRedo( bool ) ), _auxButtons, TQT_SLOT( slotCanRedo( bool ) ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( anythingSelected( bool ) ), _auxButtons, TQT_SLOT( slotCanCut( bool ) ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( anythingSelected( bool ) ), _auxButtons, TQT_SLOT( slotCanCopy( bool ) ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( anythingOnClipboard( bool ) ), _auxButtons, TQT_SLOT( slotCanPaste( bool ) ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( canSave( bool ) ), _auxButtons, TQT_SLOT( slotCanSave( bool ) ) ); connect( _scrolledEditorWindow, TQT_SIGNAL( verifyRegExp() ), this, TQT_SLOT( maybeVerify() ) ); connect( _verifyButtons, TQT_SIGNAL( loadVerifyText( const TQString& ) ), this, TQT_SLOT( setVerifyText( const TQString& ) ) ); // connect( _verifier, TQT_SIGNAL( countChanged( int ) ), _verifyButtons, TQT_SLOT( setMatchCount( int ) ) ); // TQt anchors do not work for <pre>...</pre>, thefore scrolling to next/prev match // do not work. Enable this when they work. // connect( _verifyButtons, TQT_SIGNAL( gotoFirst() ), _verifier, TQT_SLOT( gotoFirst() ) ); // connect( _verifyButtons, TQT_SIGNAL( gotoPrev() ), _verifier, TQT_SLOT( gotoPrev() ) ); // connect( _verifyButtons, TQT_SIGNAL( gotoNext() ), _verifier, TQT_SLOT( gotoNext() ) ); // connect( _verifyButtons, TQT_SIGNAL( gotoLast() ), _verifier, TQT_SLOT( gotoLast() ) ); // connect( _verifier, TQT_SIGNAL( goForwardPossible( bool ) ), _verifyButtons, TQT_SLOT( enableForwardButtons( bool ) ) ); // connect( _verifier, TQT_SIGNAL( goBackwardPossible( bool ) ), _verifyButtons, TQT_SLOT( enableBackwardButtons( bool ) ) ); _auxButtons->slotCanPaste( false ); _auxButtons->slotCanCut( false ); _auxButtons->slotCanCopy( false ); _auxButtons->slotCanSave( false ); // Line Edit TQHBoxLayout* layout = new TQHBoxLayout( topLayout, 6 ); TQLabel* label = new TQLabel( i18n("ASCII syntax:"), this ); layout->addWidget( label ); clearButton = new TQToolButton( this ); const TQString icon( TQString::fromLatin1( TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase" ) ); TQIconSet clearIcon = SmallIconSet( icon ); clearButton->setIconSet( clearIcon ); layout->addWidget( clearButton ); TQToolTip::add( clearButton, i18n("Clear expression") ); _regexpEdit = new TQLineEdit( this ); layout->addWidget( _regexpEdit ); TQWhatsThis::add( _regexpEdit, i18n( "This is the regular expression in ASCII syntax. You are likely only " "to be interested in this if you are a programmer, and need to " "develop a regular expression using TQRegExp.<p>" "You may develop your regular expression both by using the graphical " "editor, and by typing the regular expression in this line edit.") ); #ifdef TQT_ONLY TQPixmap pix( "icons/error.png" ); #else TQPixmap pix = TDEGlobal::iconLoader()->loadIcon(locate("data", TQString::fromLatin1("kregexpeditor/pics/error.png") ), TDEIcon::Toolbar ); #endif _error = new TQLabel( this ); _error->setPixmap( pix ); layout->addWidget( _error ); _error->hide(); _timer = new TQTimer(this); connect( _scrolledEditorWindow, TQT_SIGNAL( change() ), this, TQT_SLOT( slotUpdateLineEdit() ) ); connect( _regexpEdit, TQT_SIGNAL(textChanged( const TQString& ) ), this, TQT_SLOT( slotTriggerUpdate() ) ); connect( _timer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotTimeout() ) ); connect( clearButton, TQT_SIGNAL( clicked() ), _regexpEdit, TQT_SLOT( clear() ) ); // Push an initial empty element on the stack. _undoStack.push( _scrolledEditorWindow->regExp() ); _redoStack.setAutoDelete( true ); TQAccel* accel = new TQAccel( this ); accel->connectItem( accel->insertItem( CTRL+Key_Z ), this, TQT_SLOT( slotUndo() ) ); accel->connectItem( accel->insertItem( CTRL+Key_R ), this, TQT_SLOT( slotRedo() ) ); setSyntax( TQString::fromLatin1( "TQt" ) ); }
// ****************************************************************************************** // Create the edit widget // ****************************************************************************************** QWidget* EndEffectorsWidget::createEditWidget() { // Main widget QWidget *edit_widget = new QWidget( this ); // Layout QVBoxLayout *layout = new QVBoxLayout(); // Simple form ------------------------------------------- QFormLayout *form_layout = new QFormLayout(); //form_layout->setContentsMargins( 0, 15, 0, 15 ); form_layout->setRowWrapPolicy( QFormLayout::WrapAllRows ); // Name input effector_name_field_ = new QLineEdit( this ); form_layout->addRow( "End Effector Name:", effector_name_field_ ); // Group input group_name_field_ = new QComboBox( this ); group_name_field_->setEditable( false ); form_layout->addRow( "End Effector Group:", group_name_field_ ); // Parent Link input parent_name_field_ = new QComboBox( this ); parent_name_field_->setEditable( false ); form_layout->addRow( "Parent Link (usually part of the arm):", parent_name_field_ ); // Parent Group input parent_group_name_field_ = new QComboBox( this ); parent_group_name_field_->setEditable( false ); form_layout->addRow( "Parent Group (optional):", parent_group_name_field_ ); layout->addLayout( form_layout ); // Bottom Buttons -------------------------------------------------- QHBoxLayout *controls_layout = new QHBoxLayout(); controls_layout->setContentsMargins( 0, 25, 0, 15 ); // Spacer QWidget *spacer = new QWidget( this ); spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); controls_layout->addWidget( spacer ); // Save QPushButton *btn_save_ = new QPushButton( "&Save", this ); btn_save_->setMaximumWidth( 200 ); connect( btn_save_, SIGNAL(clicked()), this, SLOT( doneEditing() ) ); controls_layout->addWidget( btn_save_ ); controls_layout->setAlignment(btn_save_, Qt::AlignRight); // Cancel QPushButton *btn_cancel_ = new QPushButton( "&Cancel", this ); btn_cancel_->setMaximumWidth( 200 ); connect( btn_cancel_, SIGNAL(clicked()), this, SLOT( cancelEditing() ) ); controls_layout->addWidget( btn_cancel_ ); controls_layout->setAlignment(btn_cancel_, Qt::AlignRight); // Add layout layout->addLayout( controls_layout ); // Set layout ----------------------------------------------------- edit_widget->setLayout(layout); return edit_widget; }