コード例 #1
0
ファイル: morphmenu.cpp プロジェクト: Blizzard/qt4
// Find the label whose buddy the widget is.
QLabel *buddyLabelOf(QDesignerFormWindowInterface *fw, QWidget *w)
{
    typedef QList<QLabel*> LabelList;
    const LabelList labelList = fw->findChildren<QLabel*>();
    if (labelList.empty())
        return 0;
    const LabelList::const_iterator cend = labelList.constEnd();
    for (LabelList::const_iterator it = labelList.constBegin(); it != cend; ++it )
        if ( (*it)->buddy() == w)
            return *it;
    return 0;
}
コード例 #2
0
void QDesignerFormWindowCommand::updateBuddies(QDesignerFormWindowInterface *form,
                                               const QString &old_name,
                                               const QString &new_name)
{
    QExtensionManager* extensionManager = form->core()->extensionManager();

    typedef QList<QLabel*> LabelList;

    const LabelList label_list = qFindChildren<QLabel*>(form);
    if (label_list.empty())
        return;
    
    const QString buddyProperty = QLatin1String("buddy");

    const LabelList::const_iterator cend = label_list.constEnd();
    for (LabelList::const_iterator it = label_list.constBegin(); it != cend; ++it ) {
        if (QDesignerPropertySheetExtension* sheet = qt_extension<QDesignerPropertySheetExtension*>(extensionManager, *it)) {
            const int idx = sheet->indexOf(buddyProperty);
            if (idx != -1 && sheet->property(idx).toString() == old_name)
                sheet->setProperty(idx, new_name);
        }
    }
}
コード例 #3
0
void
AverageDisplay::Initialize( const SignalProperties&, const SignalProperties& )
{
  for( size_t i = 0; i < mVisualizations.size(); ++i )
    mVisualizations[ i ].Send( CfgID::Visible, false );
  mVisualizations.clear();
  mChannelIndices.clear();
  mPowerSums.clear();
  mTargetCodes.clear();
  mSignalOfCurrentRun.clear();
#ifdef SET_BASELINE
  mBaselines.clear();
  mBaselineSamples.clear();
#endif // SET_BASELINE
  LabelList markerLabels;
  for( int i = 0; i < Parameter( "AvgDisplayMarkers" )->NumRows(); ++i )
  {
    string markerName = Parameter( "AvgDisplayMarkers" )( i, 0 );
    int position =
      MeasurementUnits::ReadAsTime( OptionalParameter( markerName, -1 ) )
                                               * Parameter( "SampleBlockSize" );
    if( position >= 0 )
      markerLabels.push_back( Label( position, markerName ) );
  }

  int numChannels = Parameter( "AvgDisplayCh" )->NumRows();
  mPowerSums.resize( maxPower + 1, vector<vector<vector<float> > >( numChannels ) );
  for( int i = 0; i < numChannels; ++i )
  {
    ostringstream oss;
    oss << "AVG" << i;
    mVisualizations.push_back( GenericVisualization( oss.str() ) );
    GenericVisualization& vis = mVisualizations[ i ];

    string windowTitle = Parameter( "AvgDisplayCh" )( i, 1 );
    if( windowTitle == "" )
      windowTitle = "unknown";
    windowTitle += " Average";
    vis.Send( CfgID::WindowTitle, windowTitle );
    // Note min and max value are interchanged to account for EEG display direction.
    vis.Send( CfgID::MinValue, int( Parameter( "AvgDisplayMin" ) ) );
    vis.Send( CfgID::MaxValue, int( Parameter( "AvgDisplayMax" ) ) );
    vis.Send( CfgID::NumSamples, 0 );
    vis.Send( CfgID::GraphType, CfgID::Polyline );

    if( !markerLabels.empty() )
      vis.Send( CfgID::XAxisMarkers, markerLabels );

    ColorList channelColors( sChannelColors );
    vis.Send( CfgID::ChannelColors, channelColors );

    vis.Send( CfgID::ChannelGroupSize, 0 );
    vis.Send( CfgID::ShowBaselines, 1 );
    vis.Send( CfgID::Visible, true );

    mChannelIndices.push_back( Parameter( "AvgDisplayCh" )( i, 0 ) - 1 );
  }

  mSignalOfCurrentRun.resize( numChannels );
#ifdef SET_BASELINE
  mBaselines.resize( numChannels );
  mBaselineSamples.resize( numChannels );
#endif // SET_BASELINE
  mLastTargetCode = 0;
}