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 } |