Back to index

salome-smesh  6.5.0
Classes | Defines | Functions
StdMeshersGUI_DistrTable.cxx File Reference
#include "StdMeshersGUI_DistrTable.h"
#include <SMESHGUI_SpinBox.h>
#include <QItemDelegate>
#include <QTableWidget>
#include <QHeaderView>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>

Go to the source code of this file.

Classes

class  StdMeshersGUI_DistrTableFrame::SpinBoxDelegate
 Custom item delegate (uses double spin box to edit table item) More...
class  StdMeshersGUI_DistrTableFrame::Table
 Table function widget. More...
struct  StdMeshersGUI_DistrTableFrame::Table::EditorData

Defines

#define SPACING   6

Functions

static void sortData (QList< double > &d)
 Sort list of points by ascending order.

Define Documentation

#define SPACING   6

Definition at line 39 of file StdMeshersGUI_DistrTable.cxx.


Function Documentation

static void sortData ( QList< double > &  d) [static]

Sort list of points by ascending order.

Definition at line 45 of file StdMeshersGUI_DistrTable.cxx.

{
  typedef QPair<double, double> Pair;
  QList<Pair> pairs;
  for ( int i = 0; i < d.count() / 2; i++ )
    pairs.append( Pair( d[i*2], d[i*2+1] ) );
  
  qSort( pairs );

  d.clear();

  Pair p;
  double prevX = 0.0, prevY = 0.0;

  d.append( prevX );
  d.append( pairs.count() > 0 ? pairs[0].second : prevY );

  foreach( p, pairs ) {
    if ( p.first > prevX ) {
      d.append( p.first  );
      d.append( p.second );
      prevY = p.second;
    }
    prevX = p.first;
  }

  if ( prevX < 1.0 ) {
    d.append( 1.0 );
    d.append( prevY );
  }
}

Here is the caller graph for this function: