| 44 | } |
| 45 | |
| 46 | void divide::execComm( Document_Interface *doc, |
| 47 | QWidget *parent, |
| 48 | QString cmd ) |
| 49 | { |
| 50 | Q_UNUSED ( parent ); |
| 51 | Q_UNUSED ( cmd ); |
| 52 | |
| 53 | d = doc; |
| 54 | |
| 55 | QList<Plug_Entity *> obj; |
| 56 | bool yes = doc->getSelect( &obj, tr( "Select a line, circle or" |
| 57 | " arc and press return" ) ); |
| 58 | if ( ! yes || obj.isEmpty() || ( obj.size() > 1 ) ) //none or multiple |
| 59 | { //entity selection |
| 60 | QMessageBox msgBox; |
| 61 | msgBox.setStyleSheet( "QLabel, QPushButton { color: blue; }" |
| 62 | "QMessageBox { border: none;" |
| 63 | //"background: rgb( 255, 0, 0 );" //white is default |
| 64 | //"font-family: Arial;" //use default font |
| 65 | //text colour is blue from QLabel |
| 66 | "font-style: italic; font-size: 11pt; }" ); |
| 67 | msgBox.setWindowTitle( tr( "Error" ) ); |
| 68 | |
| 69 | QString text = ( "Select a line, circle or arc.<br>" ); |
| 70 | if ( obj.size() > 1 ) |
| 71 | text.append( "One entity only!<br>" ); |
| 72 | text.append( "Press \"<b>Enter/Return</b>\"." ); |
| 73 | msgBox.setText( text ); |
| 74 | msgBox.setIcon( QMessageBox::Warning ); |
| 75 | |
| 76 | /* Why are we messing with screen geometry just to show an error message? |
| 77 | * Assume Qt will just take care of it! |
| 78 | * |
| 79 | * msgBox.show(); //need show to get msgBox size |
| 80 | * QPoint centerXY = findWindowCentre(); |
| 81 | * int x = centerXY.rx() - ( msgBox.width() / 2 ); |
| 82 | * int y = centerXY.ry() - ( msgBox.height() / 2 ); |
| 83 | * |
| 84 | * QRect screenGeometry = QApplication::desktop()->availableGeometry(); |
| 85 | * //in case msgBox is wholly or partially offscreen |
| 86 | * if ( x >= ( screenGeometry.width() - msgBox.width() ) ) |
| 87 | * x = QApplication::desktop()->width() - msgBox.width() - 10; |
| 88 | * if ( y >= ( screenGeometry.height() - msgBox.height() ) ) |
| 89 | * y = QApplication::desktop()->height() - msgBox.height() - 60; |
| 90 | * |
| 91 | * msgBox.move( x, y ); |
| 92 | *********************************/ |
| 93 | msgBox.exec(); |
| 94 | |
| 95 | while ( ! obj.isEmpty() ) |
| 96 | delete obj.takeFirst(); |
| 97 | |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | QString passedData; |
| 102 | for ( int i = 0; i < obj.size(); ++i ) |
| 103 | { |
nothing calls this directly
no test coverage detected