Event handling : Accessing another widget's property
OK, this should be easy.
I tried to handle drop event onto a QGraphicsView widget. Incoming data
dragged from a QTreeView widget. For that, I re-implemented these methods:
void QGraphicsScene::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
event.accept();
}
void QGraphicsScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
{
event.accept();
}
void QGraphicsScene::dropEvent(QGraphicsSceneDragDropEvent *event)
{
event.accept();
}
void QGraphicsView::dropEvent(QDropEvent *event)
{
QPixmap pixmap(event->mimedata()->urls()[0].toString().remove(0,8));
this.scene()->addPixmap(pixmap);
}
This works fine; but how can I change another graphicsview scene within
this widget's drop event? That is:
void QGraphicsView::dropEvent(QDropEvent *event)
{
QPixmap pixmap(event->mimedata()->urls()[0].toString().remove(0,8));
// I cannot access ui; and cannot access my widgets...:
ui->anotherview->scene()->addPixmap(pixmap);
}
Wednesday, 21 August 2013
Top of screen application menu bar on every monitor in multiple display
Top of screen application menu bar on every monitor in multiple display
I have a two monitor setup but the top of the screen application menu bar
appears only on one (main) monitor. I would like it to appear on both so
that I don't have to travel with my mouse from the other to the main
monitor to use it. Can this be done and how?
I have a two monitor setup but the top of the screen application menu bar
appears only on one (main) monitor. I would like it to appear on both so
that I don't have to travel with my mouse from the other to the main
monitor to use it. Can this be done and how?
Combining php function
Combining php function
This code works:
$host =
parse_url('http://www.cc.joomla.xc.my/paypal.com/myspace.com/login.php',
PHP_URL_HOST);
$host_names = explode(".", $host);
print_r($host_names);
echo "<br>";
$l = array_slice($host_names, -3);
print_r($l);
echo "<br>";
$subdomain = implode(".", $l);
echo $subdomain; //final result
Is it possible to combine function in one line for example like this:
$host_names = implode(array_slice (explode(".", $host)($host_names,
-3)(".", $l);
The example above does not worked. I think I have seen it before where you
can combine function.
Thanks in advance for any help.
This code works:
$host =
parse_url('http://www.cc.joomla.xc.my/paypal.com/myspace.com/login.php',
PHP_URL_HOST);
$host_names = explode(".", $host);
print_r($host_names);
echo "<br>";
$l = array_slice($host_names, -3);
print_r($l);
echo "<br>";
$subdomain = implode(".", $l);
echo $subdomain; //final result
Is it possible to combine function in one line for example like this:
$host_names = implode(array_slice (explode(".", $host)($host_names,
-3)(".", $l);
The example above does not worked. I think I have seen it before where you
can combine function.
Thanks in advance for any help.
Tuesday, 20 August 2013
Persistence ignorance and DDD reality
Persistence ignorance and DDD reality
I'm trying to implement fully valid persistence ignorance with little
effort. I have many questions though:
The simplest option
It's really straightforward - is it okay to have Entities annotated with
Spring Data annotations just like in SOA (but make them really do the
logic)? What are the consequences other than having to use persistance
annotation in the Entities, which doesn't really follow PI principle? I
mean is it really the case with Spring Data - it provides nice
repositories which do what repositories in DDD should do. The problem is
with Entities themself then...
The harder option
In order to make an Entity unaware of where the data it operates on came
from it is natural to inject that data as an interface through
constructor. Another advantage is that we always could perform lazy
loading - which we have by default in Neo4j graph database for instance.
The drawback is that Aggregates (which compose of Entities) will be
totally aware of all data even if they don't use them - possibly it could
led to debugging difficulties as data is totally exposed (DAO's would be
hierarchical just like Aggregates). This would also force us to use some
adapters for the repositories as they doesn't store real Entities
anymore... And any translation is ugly... Another thing is that we cannot
instantiate an Entity without such DAO - though there could be in-memory
implementations in domain... again, more layers. Some say that injecting
DAOs does break PI too.
The hardest option
The Entity could be wrapped around a lazy-loader which decides where data
should come from. It could be both in-memory and in-database, and it could
handle any operations which need transactions and so on. Complex layer
though, but might be generic to some extent perhaps...? Have a read about
it here
Do you know any other solution? Or maybe I'm missing something in
mentioned ones. Please share your thoughts!
I'm trying to implement fully valid persistence ignorance with little
effort. I have many questions though:
The simplest option
It's really straightforward - is it okay to have Entities annotated with
Spring Data annotations just like in SOA (but make them really do the
logic)? What are the consequences other than having to use persistance
annotation in the Entities, which doesn't really follow PI principle? I
mean is it really the case with Spring Data - it provides nice
repositories which do what repositories in DDD should do. The problem is
with Entities themself then...
The harder option
In order to make an Entity unaware of where the data it operates on came
from it is natural to inject that data as an interface through
constructor. Another advantage is that we always could perform lazy
loading - which we have by default in Neo4j graph database for instance.
The drawback is that Aggregates (which compose of Entities) will be
totally aware of all data even if they don't use them - possibly it could
led to debugging difficulties as data is totally exposed (DAO's would be
hierarchical just like Aggregates). This would also force us to use some
adapters for the repositories as they doesn't store real Entities
anymore... And any translation is ugly... Another thing is that we cannot
instantiate an Entity without such DAO - though there could be in-memory
implementations in domain... again, more layers. Some say that injecting
DAOs does break PI too.
The hardest option
The Entity could be wrapped around a lazy-loader which decides where data
should come from. It could be both in-memory and in-database, and it could
handle any operations which need transactions and so on. Complex layer
though, but might be generic to some extent perhaps...? Have a read about
it here
Do you know any other solution? Or maybe I'm missing something in
mentioned ones. Please share your thoughts!
How to build exe which puts files in appdata folder and creates a shortcut to the program?
How to build exe which puts files in appdata folder and creates a shortcut
to the program?
I have a javascript application.
index.php runs the application.
I want to create an exe which puts all the files into the appdata folder,
and which creates a shortcut to the index.php so that the application can
be run.
This way users don't know where the application files are so they can't
copy the application (not easily anyway).
How do I do this?
to the program?
I have a javascript application.
index.php runs the application.
I want to create an exe which puts all the files into the appdata folder,
and which creates a shortcut to the index.php so that the application can
be run.
This way users don't know where the application files are so they can't
copy the application (not easily anyway).
How do I do this?
slider works fully local but when online it doenst show
slider works fully local but when online it doenst show
i started yesterday with my portfolio site and i finished the home page.
i put it on my server and found out the slider magically didnt work .
i already checked the links to js and the (window).load i changed in
(document).ready and still no effect.
is there something wrong with the server or did i overlook something ?
website - ( responsive grid systems ) slider - ( blueberry ) online adress
- (jurjenfolkertsma.nl)
im still using original pictures becourse i didnt changed the content yet.
<head>
<link rel="stylesheet" href="blueberry.css" />
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="jquery.blueberry.js"></script>
</head>
<body>
<div class="blueberry">
<ul class="slides">
<li><img src="" /></li>
<li><img src="" /></li>
<li><img src="" /></li>
<li><img src="" /></li>
</ul>
<script>
$(window).load(function() {
$('.blueberry').blueberry();
});
</script>
</body>
</div>
i started yesterday with my portfolio site and i finished the home page.
i put it on my server and found out the slider magically didnt work .
i already checked the links to js and the (window).load i changed in
(document).ready and still no effect.
is there something wrong with the server or did i overlook something ?
website - ( responsive grid systems ) slider - ( blueberry ) online adress
- (jurjenfolkertsma.nl)
im still using original pictures becourse i didnt changed the content yet.
<head>
<link rel="stylesheet" href="blueberry.css" />
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="jquery.blueberry.js"></script>
</head>
<body>
<div class="blueberry">
<ul class="slides">
<li><img src="" /></li>
<li><img src="" /></li>
<li><img src="" /></li>
<li><img src="" /></li>
</ul>
<script>
$(window).load(function() {
$('.blueberry').blueberry();
});
</script>
</body>
</div>
Conditional classes applied in ng-repeat using $index inconsistent when filtering
Conditional classes applied in ng-repeat using $index inconsistent when
filtering
I have a ng-repeat which is filtered with an input box. In this list,
there are .active and .disabled items. Everything renders correctly, but
when I filter it with a query, the active and disabled classes are messed
up because the index of the display changed.
Here is a jsFiddle showing the problem. You see that the second row is
highlighted (class active added). Now try to type "iphone" in the input
box. The second line will be highlighted, even if it's not active.
How can I get around this and have reliable data in my ng-repeat?
filtering
I have a ng-repeat which is filtered with an input box. In this list,
there are .active and .disabled items. Everything renders correctly, but
when I filter it with a query, the active and disabled classes are messed
up because the index of the display changed.
Here is a jsFiddle showing the problem. You see that the second row is
highlighted (class active added). Now try to type "iphone" in the input
box. The second line will be highlighted, even if it's not active.
How can I get around this and have reliable data in my ng-repeat?
Subscribe to:
Posts (Atom)