src/basics.cpp

changeset 1389
3fb8ad4d27b1
parent 1364
f6a3640b1818
child 1390
3eace926af7f
equal deleted inserted replaced
1388:fb20489acf39 1389:3fb8ad4d27b1
178 178
179 QString fractionRep(int numerator, int denominator) 179 QString fractionRep(int numerator, int denominator)
180 { 180 {
181 return superscript(numerator) + "⁄" + subscript(denominator); 181 return superscript(numerator) + "⁄" + subscript(denominator);
182 } 182 }
183
184 /*
185 * Temporarily blocks the signals of `object` and calls `function`. Returns whatever `function`
186 * returns. Assumes that the function does not change the signal blocking status of `object`.
187 */
188 void withSignalsBlocked(QObject* object, std::function<void()> function)
189 {
190 bool wasBlockingSignals = object->signalsBlocked();
191 object->blockSignals(true);
192 function();
193 object->blockSignals(wasBlockingSignals);
194 }

mercurial