I need to draw a tree in tikz similar to this one:

What I CAN'T DO is drawing the dashed triangle leaves (standing for unspecified subtrees). I think I can manage to draw the legend by myself, and am working on it. Any hint or idea?
Here is a MWE showing what I did so far:
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=5cm, level 2/.style={sibling distance =2cm}]
\node[circle,draw,fill=black] {}
child{ node[circle, fill = black] {}
child{ node[circle, draw] {}
child{ node {Q1} }
}
child{ node[rectangle, fill = black] {}
child {
node[rectangle, fill = black] {}
child{ node {Q2} }
child { node[circle,draw] {}
child { node {Q3} }
}
}
}
}
child{ node[circle, draw] {}
child{ node {Q4} }
child{node {Q5} }
};
\end{tikzpicture}
\end{document}

